Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
add PHP code to specific templates « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

add PHP code to specific templates

(3 posts)
  • Started 3 years ago by PitaMaria
  • Latest reply from PitaMaria
  • This topic is resolved
  1. PitaMaria
    Member

    I'm using a Thematic child theme and I need to add a shortcode to specific template-generated pages (e.g. the archive page with the body class .category-topic). The shortcode's author says I can embed this code in my template:

    <?php
        if ( function_exists( 'nktagcloud_shortcode' ) ) {
            echo nktagcloud_shortcode( null );
        }
    
    ?>

    ... but I only want it to appear in certain pages like the one with the body class mentioned above. I'm hopeful I can achieve this by adding something to my functions.php but I don't know what to do. Any help would be much appreciated.

    Posted 3 years ago #

  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    ScottNix

    Member

    For something like this, where do you want it to appear? By default it looks like it is already set up for a widget for sidebars (so I assume not sidebars).

    // add random div
    function snix_quick_div() {
    	if ( is_category() ) {
    		if ( function_exists( 'nktagcloud_shortcode' ) ) {
    			echo nktagcloud_shortcode( null );
    		}
    	}
    }
    add_action('thematic_abovefooter','snix_quick_div');

    The above little snippet will insert it at the bottom of "every" category. To only select certain categories, see the examples on the codex of how to take care of that.

    Also it is set to insert the action "thematic_abovefooter" or above the footer. If you wanted to move the location, view visualizing thematic which will show you some hooks to move it around (easily).

    This should work, hopefully the info from the links shows you how to get it exactly how you want.

    Posted 3 years ago #
  3. PitaMaria
    Member

    @ScottNix: Thorough and complete. Your solution worked perfectly and your links couldn't have been more helpful. Thanks for your contributions to this forum and to my issue; I really appreciate it.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183