[Resolved] hook element display rules have a mind of their own

Home Forums Support [Resolved] hook element display rules have a mind of their own

Home Forums Support hook element display rules have a mind of their own

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #1397883
    Leslie

    Hi GP team. I have a question about display rules for hook elements. I have created three different hook elements to display three different custom searchforms, in order to limit search results to specified custom post types. The hook for each searchfom is “before main content.” In the element display settings, I am choosing the relevant custom taxonomy archive pages (and other pages) where I want each searhform to appear. However, the display settings seem to have a mind of their own. After I make my display choices, everything seems to work fine while testing my site, but inexplicably, when I next look at the hook element settings, they have changed! To help explain: I have 3 custom post types: “rules abc”, “rules xyz” and “definitions”. These three post types share a custom taxonomy “sources.” So, for the “rules abc” hook element, my display selection includes “rules abc source archive — all sources”. This setting likes to switch on me and become “definitions source archive – all sources”! The same thing happens with the “rules xyz” hook element: the display setting “rules xyz source archive — all sources” switches on me to “definitions source archive – all sources”. Frankly, I am pretty sure that this is not actually affecting the front end of my site, but the settings jumping around like this is giving me pause and I wanted to ask if you’ve seen this issue before or have any insight into what might be causing it. Thanks very much for your help. PS GP rocks. Leslie

    #1398740
    David
    Staff
    Customer Support

    Hi there,

    that is peculiar … could you provide me a screenshot of the Display Rules ? Just so i can get an idea whether something is interfering with it.

    #1399261
    Leslie

    Hi, I will reply as soon as I can. I can no longer click on any of the options buttons in any of my GP elements so I can’t send you a screen shot. I have reached out to my host, Kinsta, to see if they can help me debug. I just updated both GP Premium and WP so I’m wondering if that triggered some problem. I am freaking out a bit because even my front page blocks are screwed up. Yikes.

    #1399440
    Leslie

    Sorry I can’t figure out how to get a screen shot. But my searchforms are completely malfunctioning now. Several days ago I was alerted that a new version of GP Premium was availalble, but I got an error message “unauthorized” when I tried to install it. So I waited a couple of days. Yesterday I installed it. I also installed the latest version of WP in the past couple of days. Have you heard of any conflicts? I feel like my site is disentegrating. Kinsta said there is nothing in the error logs that allows them to help me. They said deactivate all plugins so I am trying that, but of course I need to keep my GP elements and Relevanssi otherwise I can’t test the search funtion. I am just getting “nothing found” now for my search results. I can click on the options buttons but it’s the same behaviour as I described yeseterday with my choices changing. However, that’s been the case since I created the elements, it’s not a new problem so something else is causing my search to break down.

    #1399443
    Leslie

    Here is one of the error messages in my log:

    2020/08/12 17:30:36 [error] 96451#96451: *177168 FastCGI sent in stderr: “PHP message: PHP Notice: Undefined index: sources in /www/lexata_766/public/wp-content/plugins/LexRelChecklist-plugin/LexRelChecklist-plugin.php on line 30” while reading upstream, client: 184.146.153.228, server: lexata.kinsta.cloud, request: “GET /?s=duties+of+manager&post_types=inv_funds HTTP/1.0”, upstream: “fastcgi://unix:/var/run/php7.3-fpm-lexata.sock:”, host: “lexata.kinsta.cloud”, referrer: “http://lexata.kinsta.cloud/?s=deadline&post_types=inv_funds”

    “Sources” is my custom taxonomy which I’ve had operating for a few months.

    #1399451
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What’s the LexRelChecklist-plugin/LexRelChecklist-plugin.php plugin? That error is a coding error within that file.

    The Elements issue sounds like something may be misconfigured with the post types/taxonomies. Values will only change like that if entries share the same value, which they shouldn’t by default.

    I’m not sure about the search issue – have you checked with Relevanssi on that?

    #1399732
    Leslie

    The custom post types do share a taxonomy.

    Sorry I didn’t mean to send you the Relevanssi error, that error is new also since I updated GP and WP within the past couple of days, and yes I am talking to them about it. The error I meant to show you is this one:

    Notice: Undefined variable: post in /www/lexata_766/public/wp-content/plugins/gp-premium/elements/class-hooks.php(196) : eval()’d code on line 14

    Notice: Trying to get property ‘ID’ of non-object in /www/lexata_766/public/wp-content/plugins/gp-premium/elements/class-hooks.php(196) : eval()’d code on line 14

    #1399735
    Tom
    Lead Developer
    Lead Developer

    Since they share a taxonomy, it could mean that the items in the Display Rules share a value as well. The good news there is it likely shouldn’t matter that it switched (to the lower item, likely). If the values are the same, the Element should display correctly on the front-end.

    As for the error, that’s something inside one of your Hook Elements. Feel free to share your Hook Element code and we’ll take a look.

    #1399754
    Leslie

    Thanks. Here is the code of one of the hooks that might be generating the error:

    <?php

    add_filter( ‘generate_search_placeholder’, function() {
    return __( ‘search investment funds…’, ‘Search …’ );
    } );

    echo do_shortcode( ‘[searchform post_types=”inv_funds”]’ );

    ?>

    #1400610
    David
    Staff
    Customer Support

    Hi there,

    the add_filter function cannot be added to a hook. That should go in you child themes functions.php or added via the Code Snippets plugin.

    #1401161
    Leslie

    Ok I will move those. Thanks.

    #1401764
    David
    Staff
    Customer Support

    You’re welcome

    #1403215
    Leslie

    Hi David, I have been working on this without success. I don’t know how to put the filter for the search placeholder into my child theme functions.php file and then connect it to the GP hook element where I echo the relevant searchform. Can you help me figure out what piece of the puzzle I am missing? To recap, I have this filter:

    add_filter( ‘generate_search_placeholder’, function() {
    return __( ‘search investment funds…’, ‘Search …’ );
    } );

    and I have this shortcode to limit the search results to the topic “investment funds”:

    echo do_shortcode( ‘[searchform post_types=”investment_funds”]’ );

    I want to display this custom searchform on certain pages and archives on my site. (I have other custom searchforms for other topics that I want to display on other pages and archives.) How can I distinguish my searchforms from each other and echo the right ones on the right pages?

    When I had everything (placeholder filters and searchform shortcodes) inside GP hook elements, it seemed so easy – all of my custom searchforms displayed where they should and my search results performed properly. But I starting having problems after updating WP and GP Premium, so I turned on debug mode and realized I had errors.

    Your help is much appreciated.

    #1403732
    David
    Staff
    Customer Support

    Are you using a plugin for the search form ?
    ie. one that provides that shortcode.

    #1404517
    Leslie

    Hi, yes I am using Relevanssi for search and the searchform shortcome comes from that plugin. Leslie

Viewing 15 posts - 1 through 15 (of 27 total)
  • You must be logged in to reply to this topic.