Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Patrick Jackson

    (@pjackson1972)

    Hi gjuddy,

    Sounds interesting! I’d handle that by concatenating the title using get_the_title(). Try this….

    <?php echo do_shortcode("[ic_add_posts tag='" . get_the_title() . "' showposts='3']"); ?>
    Thread Starter gjuddy

    (@gjuddy)

    Thanks Patrick, works great. How about if I want to find the title of a post I’m loading on the same page and use that…so I’m loading 2 different featured posts on my homepage. I want to be able to grab the title of one of the featured posts and use it as the tag on the other featured post…

    First one:

    <?php echo do_shortcode('[ic_add_posts category="' . date("F") . '" showposts="1" orderby="rand" template="posts_homepage_template.php"]'); ?>

    Second one:

    <?php echo do_shortcode('[ic_add_posts post_type="recipes" tag="' . $title . '" showposts="1" orderby="rand" template="posts_homepage_template.php"]'); ?>

    Now how do I get the title variable to reflect the title of the post loaded in the first call?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get page title to use as tag in template shortcode’ is closed to new replies.