Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Align fields and make them non-bullet points and remove Related Post content

Viewing 8 posts - 21 through 28 (of 28 total)
  • Christiaan Punter
    #262713

    That fixed it, thanks Trevor!

    Now the only remaining issue is the repeated Related Post content and the speed issue that is, hopefully, related to this.

    Related Post Plugin page: https://pickplugins.com/item/related-post-for-wordpress/.

    There is some information on the plugin developer’s site on how to disable the Related Post content on a particular page but I can’t get that to work, perhaps this may help you: https://pickplugins.com/documentation/related-post/action-hook/related_post_main/

    Trevor Moderator
    #262719

    In the child theme functions.php file:

    add_action('related_post_main','related_post_main_remove_hook_sandf', 0);
    function related_post_main_remove_hook_sandf() {
        if (is_page(25640)) {
            remove_action('related_post_main','related_post_main_title');
            remove_action('related_post_main','related_post_main_post_loop');
            remove_action('related_post_main','related_post_main_css');
            remove_action('related_post_main','related_post_main_slider_scripts');
        }
    }

    I think that would do it.

    Christiaan Punter
    #262722

    Alas, that seems to work when loading the page for the first time but after the first different search, the Related Post content is again shown after each Search and Filter result.

    Trevor Moderator
    #262728

    Try this (not sure this will work):

    add_action('related_post_main','related_post_main_remove_hook_sandf', 0);
    function related_post_main_remove_hook_sandf() {
      global $searchandfilter;
      $sf_current_query = $searchandfilter->get(25639)->current_query();
      if ($sf_current_query->is_filtered())||($sf_current_query->get_search_term()<>"")||is_page(25640)) {
            remove_action('related_post_main','related_post_main_title');
            remove_action('related_post_main','related_post_main_post_loop');
            remove_action('related_post_main','related_post_main_css');
            remove_action('related_post_main','related_post_main_slider_scripts');
        }
    }
    Christiaan Punter
    #262732

    Alas, that results in a Syntax Error, preventing the code to be added:

    “Your PHP code changes were rolled back due to an error on line 1082 of file wp-content/themes/theblog/functions.php. Please fix and try saving again.”

    syntax error, unexpected ‘||’ (T_BOOLEAN_OR)

    FYI: line 1082 holds the following line of your code: if ($sf_current_query->is_filtered())||($sf_current_query->get_search_term()<>””)||is_page(25640)) {

    Trevor Moderator
    #262734

    One too many brackets (after the is_filtered), OR paste this corrected line instead:

    if ($sf_current_query->is_filtered()||($sf_current_query->get_search_term()<>"")||is_page(25640)) {

    Christiaan Punter
    #262808

    Brilliant, that works beautifully! And the page now also loads nice and quick. Thanks Trevor!

    Trevor Moderator
    #262812

    Thanks for letting me know. I will close this thread for now.

Viewing 8 posts - 21 through 28 (of 28 total)

The topic ‘Align fields and make them non-bullet points and remove Related Post content’ is closed to new replies.