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
Hook for post "entry-content" class? « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

Hook for post "entry-content" class?

(8 posts)
  • Started 4 years ago by stonefree
  • Latest reply from helgatheviking
  • This topic is resolved

  1. 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
    stonefree

    Member

    I'm trying to insert some images at the beginning of every <div class="entry-content"> on all page templates . I couldn't find a hook in the documentation. What is the best way to do this?

    Posted 4 years ago #
  2. middlesister
    Member

    Try filtering thematic_post.

    function childtheme_add_to_content($content) {
        $my_addition = 'image goes here';
        $content = $my_addition . $content;
        return $content;
    }
    add_filter('thematic_post', 'childtheme_add_to_content');
    Posted 4 years ago #

  3. 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
    helgatheviking

    Moderator

    +1 for middlesister's solution

    Posted 4 years ago #
  4. PMix
    Member

    I would like to do essentially the same thing except I want to display the featured image for the post. When I use this code:

    `function childtheme_feature_image($content) {
        	$my_addition = '<div id="inside-post-thumbnail">
    				<?php the_post_thumbnail(\'medium\');?>
    			</div>';
        	$content = $my_addition . $content;
        	return $content;
    }
    add_filter('thematic_post', 'childtheme_feature_image');

    Wordpress doesn't end up running the php code to display the thumbnail image. The html outputs as

    <div id="inside-post-thumbnail">
    <!--?php the_post_thumbnail('medium');?-->
    </div>

    What do I do to get it to execute that line of php code?

    Posted 3 years ago #

  5. 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
    helgatheviking

    Moderator

    when using filters you must not use code that ECHOS, you must RETURN values. the_post_thumbnail echoes. you are also weirdly shifting back and forth between html and php when you are trying to set your variable.

    try :

    function childtheme_feature_image($content) {
            global $post;
        	$my_addition = '<div id="inside-post-thumbnail">. get_the_post_thumbnail($post->ID,'medium') .'</div>';
        	$content = $my_addition . $content;
        	return $content;
    }
    add_filter('thematic_post', 'childtheme_feature_image');

    most WP functions that echo something have a sister function that gets the value instead, for use w/ filters

    http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

    Posted 3 years ago #
  6. PMix
    Member

    I think the $my_addition line needs to be

    $my_addition = '<div id="inside-post-thumbnail"> . get_the_post_thumbnail($post->ID,\'medium\') . </div>';

    but using that just outputs ". get_the_post_thumbnail($post->ID,'medium') ." inside the div tags.

    Posted 3 years ago #
  7. PMix
    Member

    For whatever reason

    function childtheme_feature_image($content) {
            global $post;
        	$my_addition = get_the_post_thumbnail($post->ID,'medium');
        	$content = $my_addition . $content;
        	return $content;
    }
    add_filter('thematic_post', 'childtheme_feature_image');

    works. I can just style with the img tags instead of using the div tags.

    Thanks so much for your help.

    Posted 3 years ago #

  8. 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
    helgatheviking

    Moderator

    it was because you were escaping the ' where you didn't need to escape them.... \'medium\' instead of 'medium'

    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