• Resolved tonyx4x44

    (@tonyx4x44)


    I addeed a widget to under content using this code

    // Adds a widget area.
    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    	'name' => 'Extra Header Widget Area',
    	'id' => 'extra-widget-area',
    	'description' => 'Extra widget area after the header',
    	'before_widget' => '<div class="widget my-extra-widget">',
    	'after_widget' => '</div>',
    	'before_title' => '<h2>',
    	'after_title' => '</h2>'
    	));
    }
    
    // Place the widget area after the header
    add_action ('__after_content', 'add_my_widget_area', 10);
    function add_my_widget_area() {
      if (function_exists('dynamic_sidebar')) {
        dynamic_sidebar('Extra Header Widget Area');
      }
    }
    
    ?>

    and it works fine.

    My problem is that jetpack related posts appear above it… is there a way to move the widget above the related posts?

    sample link

    this is the function for the related post

    function jetpackme_related_posts_headline( $headline ) {
    $headline = sprintf(
                '<h3 class="jp-relatedposts-headline"><em>%s</em></h2>',
                esc_html( 'CHECK THESE OUT!' )
                );
    return $headline;
    }
    add_filter( 'jetpack_relatedposts_filter_headline', 'jetpackme_related_posts_headline' );
    
    function jetpackme_more_related_posts( $options ) {
        $options['size'] = 6;
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );
Viewing 1 replies (of 1 total)
  • Have you tried changing the priority of the hook?

    Change this line

    add_action ('__after_content', 'add_my_widget_area', 10);

    to

    add_action ('__after_content', 'add_my_widget_area', 5);

    Does that help?

Viewing 1 replies (of 1 total)
  • The topic ‘below content arrangement’ is closed to new replies.