The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Help with Post Tags and Related Post CODE!!! (1 post)

  1. robbie59
    Posted 7 years ago #

    I'm trying to join these two sets of code. The first code pulls the "tags" used in the current page and then calls for related pages using the same tags

    The second code is a slider that displays posts.

    I want the slider to pull post from related post containing the same "tags." This should be possible due to the "tag" code. I'm close, I cannot get it to work with the "loopcounter."

    Please help me out if you can, I'm not sure if I explained that right. Thanks in advance

    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
    $tag_ids = array();
    foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

    'tag__in' => $tag_ids,
    'post__not_in' => array($post->ID),
    'showposts'=>5, // Number of related posts that will be shown.

    <?php $my_query = new wp_query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) { $my_query->the_post(); ?>

  2. " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
  3. <?php

    <!-- Next Code -->

    <div id="videolist">
    <div id="slider">
    <div class="scroll">
    <div class="scrollContainer">
    <!-- item begin -->
    <div class="panel">

    <?php $temp_query = $wp_query; ?>
    <?php query_posts('showposts=10000'); ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); $loopcounter++; ?>
    <div class="videoitem">
    " href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php get_the_image(array('default_size' => 'thumbnail')); ?>&h=65&w=102&zc=1&q=80" alt="<?php the_title(); ?>" />
    " title="View"><h3><?php the_title() ?></h3>
    <?php the_excerpt(); ?>
    <?php if ($loopcounter % 4 == 0) { ?>
    <!-- item end -->
    <!-- item begin -->
    <div class="panel">
    <?php } ?>

    <?php endwhile; else: ?>
    <?php endif; ?>
    <?php $wp_query = $temp_query; ?>
    <!-- item end -->


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.