WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Making shortcodes more dynamic (2 posts)

  1. webtomap
    Member
    Posted 2 years ago #

    I am using a plugin (wp geo big map). If i put the following shortcode ( [big_map ... lines="0" tag="fast" cat="2"]
    ) into a post or page it returns a map with all the posts that i specified.

    If I want to use the shortcode in my theme files, I use : <?php echo do_shortcode('[big_map ... lines="0" tag="fast" cat="2"]'); ?>

    So far everything is oke.

    But in my Archives (archive.php)file I want the Shortcode to behave dynamically. I want the variables cat (category) and tag to change with the different archive pages. If I go to the tag page of the tag slow I want the posts containing the tag slow to be displayed on the map.

    Have found some suggestions but nothing worked for me.

    Hope someone can help

  2. webtomap
    Member
    Posted 2 years ago #

    have tried

    <?php

    $current_tag = single_tag_title("", false);

    echo do_shortcode('[big_map ... lines="0" tag='.$current_tag.']');

    ?>

    and it worked

Topic Closed

This topic has been closed to new replies.

About this Topic