Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi rmblfish

    That’s because Pages usually don’t have taxonomy support unless you (or a theme or plugin) adds it.

    Can you assign taxonomy terms to pages?

    If so, you can have the widget search related posts for pages by adding support for it in the widget.
    https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/recipes/#widget_page

    btw:
    consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.

    Thread Starter rmblfish

    (@rmblfish)

    thanx @keesiemeijer
    added plugin category-to-pages-wud (https://wordpress.org/plugins/add-category-to-pages/) also tested this plugin (https://wordpress.org/plugins/add-category-to-pages/)
    and also added the code to functions.php so i got to choose pages under POST TYPES in widget but still gets the same results as before…
    the code i added from your blog

    // Add the 'page' post type just after the plugin's defaults are set (priority 11).
    add_action( 'wp_loaded', 'add_widget_related_post_type_page', 11 );
     
    function add_widget_related_post_type_page() {
     
        if ( !class_exists( 'Related_Posts_By_Taxonomy_Defaults' ) ) {
            return;
        }
     
        $defaults = Related_Posts_By_Taxonomy_Defaults::get_instance();
        $defaults->post_types['page'] = __( 'Pages' );
    }
    Plugin Author keesiemeijer

    (@keesiemeijer)

    Can you add this to your theme’s functions.php for troubleshooting

    
    add_filter( 'related_posts_by_taxonomy_widget_hide_empty', '__return_false' );
    

    Does it show “No related posts found” or still nothing after adding that?

    • This reply was modified 6 years, 3 months ago by keesiemeijer.
    Thread Starter rmblfish

    (@rmblfish)

    thanx @keesiemeijer

    still nothing found after adding it…

    Plugin Author keesiemeijer

    (@keesiemeijer)

    That’s strange.

    I’ve installed the Add Category to Pages plugin to see if there are any compatibility issues. It seems to work on my install.

    As you didn’t see the “No related posts found” text it is as if the widget is never called.

    Does your theme have multiple widget areas, and is it added to the correct one?

    Try deactivating all all plugins (except the related and add category to pages plugins) to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    Thread Starter rmblfish

    (@rmblfish)

    NOW i can see the “No related posts found” … !
    @keesiemeijer

    regards

    Plugin Author keesiemeijer

    (@keesiemeijer)

    Does it now work as intended or is there still an issue why there are no related posts found?

    Thread Starter rmblfish

    (@rmblfish)

    Hi
    there is still no related posts showing up on PAGES sidebar widget but other stuff is showing up there too… (http://elektrosmog.se/kontakt/)
    its working only showing related posts on POSTs if you know what i mean…
    (http://elektrosmog.se/) and (http://elektrosmog.se/microsoftdirektor-havdar-att-telekomindustrin-doljer-riskerna/)

    regards

    Kenneth

    Plugin Author keesiemeijer

    (@keesiemeijer)

    For troubleshooting put this in the theme’s functions.php file:

    
    add_filter( 'related_posts_by_taxonomy_debug', '__return_true' );
    

    It will show troubleshoot information (to logged in admins) in the footer of your website if a shortcode was found.

    Post the troubleshoot information here.

    Thread Starter rmblfish

    (@rmblfish)

    Hi again!

    am using the widget in sidebar but also put in shortcode in HTMLwidget in sidebar now and got this troubleshoot info:
    regards

    
    **********************************************
    **                                          **
    **    Related Posts by Taxonomy Supports    **
    **                                          **
    **********************************************
    
    Plugin Supports 
    
    Array
    (
        [widget] => 1
        [shortcode] => 1
        [shortcode_hide_empty] => 1
        [widget_hide_empty] => 
        [cache] => 
        [display_cache_log] => 
        [wp_rest_api] => 
        [debug] => 1
    )
    *****************************************************
    **                                                 **
    **    Related Posts by Taxonomy Debug shortcode    **
    **                                                 **
    *****************************************************
    
    current post id:
    
    11
    
    -------------------------------------------
    taxonomies used for related query:
    
    'category', 'post_tag', 'post_format'
    
    -------------------------------------------
    terms found for current post:
    
    Array
    (
    )
    
    -------------------------------------------
    terms used for related query:
    
    -------------------------------------------
    related post ids found:
    
    -------------------------------------------
    shortcode args:
    
    Array
    (
        [post_types] => Array
            (
                [0] => page
            )
    
        [posts_per_page] => 5
        [order] => DESC
        [fields] => 
        [limit_posts] => -1
        [limit_year] => 
        [limit_month] => 
        [orderby] => post_date
        [exclude_terms] => 
        [include_terms] => 
        [exclude_posts] => 
        [post_thumbnail] => 
        [related] => 1
        [public_only] => 
        [include_self] => 
        [post_id] => 11
        [taxonomies] => all
        [title] => Related Posts
        [format] => links
        [image_size] => thumbnail
        [columns] => 3
        [link_caption] => 
        [caption] => post_title
        [before_shortcode] => <hr><div class="rpbt_shortcode">
        [after_shortcode] => </div>
        [before_title] => <h3>
        [after_title] => </h3>
        [type] => shortcode
    )
    
    -------------------------------------------
    function args:
    
    -------------------------------------------
    related posts query:
    
    -------------------------------------------
    requested template:
    
    related-posts-links.php
    
    -------------------------------------------
    **************************************************
    **                                              **
    **    Related Posts by Taxonomy Debug widget    **
    **                                              **
    **************************************************
    
    current post id:
    
    11
    
    -------------------------------------------
    taxonomies used for related query:
    
    'category'
    
    -------------------------------------------
    terms found for current post:
    
    Array
    (
    )
    
    -------------------------------------------
    terms used for related query:
    
    -------------------------------------------
    related post ids found:
    
    -------------------------------------------
    widget args:
    
    Array
    (
        [post_types] => Array
            (
                [0] => post
                [1] => es_template
                [2] => page
            )
    
        [posts_per_page] => 3
        [order] => RAND
        [fields] => 
        [limit_posts] => -1
        [limit_year] => 
        [limit_month] => 
        [orderby] => post_date
        [exclude_terms] => 
        [include_terms] => 
        [exclude_posts] => 
        [post_thumbnail] => 
        [related] => 1
        [public_only] => 
        [include_self] => 
        [post_id] => 11
        [taxonomies] => category
        [title] => Utvalda artiklar!
        [format] => links
        [image_size] => thumbnail
        [columns] => 3
        [link_caption] => 
        [caption] => post_title
        [singular_template] => 
        [type] => widget
        [q2w3_fixed_widget] => 1
    )
    
    -------------------------------------------
    function args:
    
    -------------------------------------------
    related posts query:
    
    -------------------------------------------
    requested template:
    
    related-posts-links.php
    
    -------------------------------------------
    widget:
    
    Array
    (
        [name] => Primär sidopanel
        [id] => sidebar-1
        [description] => Primär sidopanel som visas till vänster.
        [class] => 
        [before_widget] => <aside id="related-posts-by-taxonomy-3" class="widget related_posts_by_taxonomy">(<a href="#rpbt-widget-debug-1">Debug Widget</a>)<br/>
        [after_widget] => </aside>
        [before_title] => <h1 class="widget-title">
        [after_title] => </h1>
        [widget_id] => related-posts-by-taxonomy-3
        [widget_name] => Related Posts By Taxonomy
    )
    
    -------------------------------------------
    • This reply was modified 6 years, 3 months ago by keesiemeijer.
    Plugin Author keesiemeijer

    (@keesiemeijer)

    It doesn’t find the category terms assigned to the post.

    What categories does the Page /forskning have?

    Thread Starter rmblfish

    (@rmblfish)

    GOT IT!
    ooops bummer …
    sorry didnt understand pages must have categories attached to it =) *shame*
    my big mistake…

    now it works super!

    thanx for great support though

    regards
    Kenneth

    • This reply was modified 6 years, 3 months ago by rmblfish.
    Plugin Author keesiemeijer

    (@keesiemeijer)

    You’re welcome. I’m glad you’ve got it solved 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘plugin shows up in sidebar only on posts, not on pages…’ is closed to new replies.