Documentation

Didn't find anything? Ask your questions in the forum.
Documentation Getting Started Shortcodes

Shortcodes

Help: If you do not know how to execute or save your own PHP code, you can find help here: How to execute PHP code on your WordPress website

You can also output Helpful using shortcodes on your page. This is useful if you only want to show Helpful in certain places. The basic shortcode looks like this:

[helpful]

You can also change individual parameters. Actually, you can change almost anything, but this could break Helpful, here’s an example of how to change the heading:

[helpful heading="My new heading!"]

Default Values

$defaults = [
    'heading' => string,
    'content' => string,
    'button_pro' => string,
    'button_contra' => string,
    'counter' => bool,
    'count_pro' => Helpful\Core\Helpers\Stats::get_pro($post_id),
    'count_pro_percent' => Helpful\Core\Helpers\Stats::get_pro($post_id, true),
    'count_contra' => Helpful\Core\Helpers\Stats::get_contra($post_id),
    'count_contra_percent' => Helpful\Core\Helpers\Stats::get_contra($post_id, true),
    'credits' => bool,
    'credits_html' => string,
    'exists' => int (1/0),
    'exists_text' => string,
    'post_id' => integer,
];

With this you can adjust the shortcode. For example if we want to change the text for the Pro Button:

[helpful button_pro="yes" button_contra="no"]

If you want to use the shortcode with PHP, it works like this:

<?php

echo do_shortcode( '[helpful button_pro="yes" button_contra="no"]' );

Was this post helpful?