• Resolved ahmedalmulki

    (@ahmedalmulki)


    Hi all,
    I have problem with related post with custom content type “portfolio” , i can’t see related post i try to add this code to my theme function.php but no luck

    function allow_my_post_types($allowed_post_types) {
    $allowed_post_types[] = 'portfolio';
    return $allowed_post_types;
    }
    
    add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types');

    any advice please .

    https://www.ads-software.com/plugins/jetpack/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Is the Portfolio Post Type managed by Jetpack? Did you enable that Post Type by going to Settings > Writing in your dashboard, or by using a theme that supports Jetpack Portfolios out of the box?

    If so, you’ll need to replace portfolio by jetpack-portfolio in the code above, like so:

    function allow_my_post_types($allowed_post_types) {
    $allowed_post_types[] = 'portfolio';
    return $allowed_post_types;
    }
    
    add_filter( 'rest_api_allowed_post_types', 'allow_my_post_types');

    It’s worth noting that this won’t be necessary starting in Jetpack 4.2, scheduled to be released next week. Jetpack Portfolios will handle Related Posts out of the box.

    I hope this helps.

    Thread Starter ahmedalmulki

    (@ahmedalmulki)

    My Portfolio created by theme owner not from Jetpack portfolio , so you told me in the next update after one week my solution will work even in my Portfolio ?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    That will depend on how your theme implemented its Portfolio feature. Could you let me know what your theme is? Is there somewhere I can download it to see how it’s built?

    Thread Starter ahmedalmulki

    (@ahmedalmulki)

    Thanks for your support ,
    my client theme is Hiker “https://themeforest.net/item/hiker-wordpress-photography-theme/7021802?s_rank=1”

    i use some code in single-portfolio.php to let related posts appears but not by using Jetpack related post feature, but i want to know how can i solve this problem because i like your plugin and i use it in all my websites .

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Since that’s a premium theme, I can’t download it to look at its code. I was, however, able to look at the demo, and the portfolio Post Type appears to be named portfolio, so the code you posted in your first message should be enough to get Portfolio posts to be indexed as well.

    Once that’s done, Related Posts should appear at the bottom of the portfolio projects, as long as single-portfolio.php includes the the_content() function.

    Could you give it another try? If that still doesn’t work, could you let me know your site URL so I can take a closer look at the problem?

    If you want your site URL to remain private, you can also contact us via this contact form:
    https://jetpack.com/contact-support/

    Thanks!

    Thread Starter ahmedalmulki

    (@ahmedalmulki)

    I return the code to function.php “child theme” and re-enable jetback related post but no luck can you check from your end and this is my client portfolio

    https://www.frontlineinfocus.com/en/portfolio/second/

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Could you try to install and activate this small plugin, by going to Plugins > Add New > Upload in your dashboard:
    https://i.wpne.ws/Vdoc

    Once you’ve activated the plugin, try to relaunch the indexation (you’ll find the reindex button by clicking on the “Debug” link at the bottom of the Jetpack menu in your dashboard).
    If the Related Posts start appearing, you can deactivate and delete this small plugin.

    Let me know if it helps.

    Thread Starter ahmedalmulki

    (@ahmedalmulki)

    also not working after i do all mentioned steps but no luck , did you think this solution not work because i use another related posts function inside single-portfolio.php ?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    No, that shouldn’t be related.

    How many Portfolio posts have you published so far? Jetpack’s Related Posts won’t be displayed until you’ve published enough posts so relevant related posts can be returned.

    kellyfro

    (@kellyfro)

    Hi Jeremy,
    I am having the opposite problem…I can’t make Jetpack stop activating the related posts plugin! I keep turning it off in settings but as soon as I close the page it turns it back on. I already have related posts in my Woocommerce cart so don’t need it. Please advise!
    Thank you!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @kellyfro Could you please start your own thread, as per the Forum Welcome?
    https://www.ads-software.com/support/plugin/jetpack#new-post

    Could you also try to deactivate the Related Posts module via the old module list interface:
    https://yoursite.com/wp-admin/admin.php?page=jetpack_modules

    Thank you!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Related Post’ is closed to new replies.