• Hi, what’s the difference between the logs in the Start page and Log page under settings?
    I noticed that votes are not coming in in the Start age log, only in the Bar Chart.

    Please advise, thank you

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Pixelbart

    (@pixelbart)

    @meir321

    On the start page the individual votes for single posts are shown. The charts do not show the table, only always the selected time.

    The logs under Logs, are the logs. So there the single votes are listed. On the start page the posts with the totals of the votes.

    Thread Starter meir321

    (@meir321)

    Hi, the votes are not showing up on the Start page only in the log page.

    Plugin Author Pixelbart

    (@pixelbart)

    @meir321

    It is important that only those entries are visible on the start page that are also set under “Post Types” in the settings. For example, if you want to see pages, but you have only selected “post”, it will not be shown.

    The logs show all saves, even those saved by content that is no longer active.

    Thread Starter meir321

    (@meir321)

    Oh, now I understand. Is there a way for everything to display there even if it’s not set under Post Type? For example if it’s displayed with Shortcode.

    Plugin Author Pixelbart

    (@pixelbart)

    @meir321 I published you an update. That should help you so far, I hope. You can read more about it here:

    https://helpful-plugin.info/docs/filters/helpful-ajax_get_posts_data-args/

    Thread Starter meir321

    (@meir321)

    Hi, thanks for your response.
    How can I use this to display on the start page all votes that were submitted via shortcode?

    Plugin Author Pixelbart

    (@pixelbart)

    @meir321

    You need to find out what Post Types you are using to do this. Unfortunately, I can’t tell you that. By default Helpful uses “any”, which only addresses all existing post types (from WordPress).

    • This reply was modified 3 years, 3 months ago by Pixelbart.
    Thread Starter meir321

    (@meir321)

    Thank you.

    The only issue is, this code only works if you select that custom post type mentioned in the code in the Details Page under Post Types. In my case that custom post type is not selected there (otherwise would display helpful twice on single custom post type pages) and is only displayed via shortcode, so the provided code is not targeting it.

    Is there a way for the code to target the set custom post type even if it’s not selected under the details page?

    Plugin Author Pixelbart

    (@pixelbart)

    @meir321

    The mentioned filter is intended for exactly this problem. You can set your post types there without setting them in the settings.

    This filter only works on the start page in Helpful’s settings.

    functions.php:

    /**
     * @param array $args
     * @return array
     */
    add_filter('helpful/ajax_get_posts_data/args', function(array $args) {
        $args['post_type'][] = 'my-custom-post-type'; // <-- here
        return $args;
    });

    `

    See: https://github.com/pixelbart/helpful/blob/master/core/tabs/class-start.php#L191

    Thread Starter meir321

    (@meir321)

    Hi, I tested it and it does not work unless the custom post type is also set in the settings.

    So if I add the following code to the Functions.php it will only show in the Start page if I also select Helpie FAQ in the settings. The same with any custom post type I tested.

    add_filter('helpful/ajax_get_posts_data/args', function(array $args) {
        $args['post_type'] = ['helpie_faq'];
        return $args;
    });
    Plugin Author Pixelbart

    (@pixelbart)

    @meir321

    /**
     * @param array $args
     * @return array
     */
    add_filter('helpful/ajax_get_posts_data/args', function(array $args) {
        $args['post_type'] = 'helpie_faq'; // <-- here
        return $args;
    });

    I have checked this on 4 pages for me. It works fine, directly in the functions.php. Here in the example I have selected only the post.

    In the settings I have selected a completely different. Then only the post are shown to me. With a custom post type I have also tested this. It always works fine.

    You may have to check in another place why this is not working. You can use the Query Monitor, but also set WP_DEBUG and WP_DEBUG_LOG to true, in your wp-config.php file. After that, in the debug.log directly in your wp-content/ folder, should put all the info, if there is an error.

    Otherwise your post type will be registered differently, or incorrectly. You can still try to put an init in front of it if necessary:

    add_action('init', function() {
        /**
         * @param array $args
         * @return array
         */
        add_filter('helpful/ajax_get_posts_data/args', function(array $args) {
            $args['post_type'] = 'helpie_faq'; // <-- here
            return $args;
        });
    });

    Also with this, it works for me right away, without any problems.

    Debugging in WordPress: https://helpful-plugin.info/docs/getting-started/debugging-in-wordpress/

    • This reply was modified 3 years, 3 months ago by Pixelbart.
    Thread Starter meir321

    (@meir321)

    Hi, I was unable to get it to work either way. Thank you for trying to assist. I will use the log page for now.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Start and Log Page’ is closed to new replies.