• I would like to remote include a list of boats for sale. By adding a few words to that query it then shows related boats for sale to those keywords.
    The boats need to come in to the sidebar so I had:

    <?php query_posts(); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php include("https://www....<urlforsearchhere>....?keyword=<?php the_tags(); ?>"); ?>
    <?php endwhile; else: endif; wp_reset_query(); ?>

    Testing the URL out of an include works, bringing back a result. Having the include with no keywords shows 4 random boats. I am testing against one post with one tag, the one tag being “1967 Donzi”.

    Any help would be very grateful.
    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter boatwizard

    (@boatwizard)

    No one have an idea?

    Wouldn’t you need to use Function_Reference/get_the_tags for that?

    Thread Starter boatwizard

    (@boatwizard)

    Thanks Michael, you’re quite right, needed get_the_tags not the_tags.

    The tags part works great now and I can get my script to print the correct url like this:

    <?php<br />
    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    $url = '"https://www.boats.com/boats/search/boats_for_sale_list.html?Ntt=' . $tag->name . '"';
    echo "$url";
    }
    }
    ?>

    But when I just use the include, it doesn’t work:

    <?php
    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    $url = '"https://www.boats.com/boats/search/boats_for_sale_list.html?Ntt=' . $tag->name . '"';
    include($url);
    }
    }
    ?>

    Any ideas what I’m doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tags and Includes – Not for the feint hearted’ is closed to new replies.