Notifications
Clear all

Paid Addons Support Forum Only

Please note, that here we only support Paid Addons issues and questions.

gVectors Support staff works from 6am to 6pm (GMT+0)

All questions related to wpForo and wpDiscuz free plugins should be asked in the corresponding plugin support forum:

 

wpDiscuz Support Forum wpForo Support Forum

Shortcodes not working inside [nextpage] tag  


CK13
 CK13
(@CK13)
New Member
Joined: 7 years ago
Posts: 4
Topic starter  

I use shortcodes in my posts to display terms from certain taxonomies, but when used between [nextpage] tag, instead of the terms i get the shortcode itself.

Is it supposed to work with shortcodes?
The shortcode is created by me so i might have missed something.

LE: when i go to a different page and back to the page with the shortcode, the shortcodes disappear (terms are still not displayed).


Quote
Tom
 Tom
(@tomson)
Support Team Admin
Joined: 6 years ago
Posts: 3332
 

Hi,
Thank you for using our plugin, could you please show the example of shortcode you use?


ReplyQuote
CK13
 CK13
(@CK13)
New Member
Joined: 7 years ago
Posts: 4
Topic starter  

Shortcode function:
function ck13_fbgm_terms($atts){
global $post;
extract(shortcode_atts(array(
'ck_term' => '',
'ck_sep' => ', ',
'ck_before' => '',
'ck_after' => ''
), $atts));

$show_the_terms = "";
$show_the_terms .= get_the_term_list( $post->ID, "$ck_term", "$ck_before", "$ck_sep", "$ck_after" );
return $show_the_terms;
}

function register_shortcodes(){
add_shortcode('fbgm-terms', 'ck13_fbgm_terms');
}
add_action( 'init', 'register_shortcodes');

Shortcode i use in posts: [fbgm-terms ck_term="audio"]
What i see in post inside [nextpage] tag: [fbgm-terms ck_term="audio"]


ReplyQuote
Tom
 Tom
(@tomson)
Support Team Admin
Joined: 6 years ago
Posts: 3332
 

Are you sure this shortcode works without [nextpage] shortcode?


ReplyQuote
Gagik
(@gagik)
Support Team Admin
Joined: 6 years ago
Posts: 9
 

Hi,

Thank you for reporting about this issue. We found the reason of it and solved the problem. You can update the plugin in order to fix the issue on your end.
If there is any problem, please just let us know.


ReplyQuote
CK13
 CK13
(@CK13)
New Member
Joined: 7 years ago
Posts: 4
Topic starter  

Works but only the first time i'm on the page with the shortcode, when i go to a different page and back to the page with the shortcode, the terms disappear.

http://hentai.pink/test-2/


ReplyQuote
Gagik
(@gagik)
Support Team Admin
Joined: 6 years ago
Posts: 9
 

We noticed that you use “Pagination loading type - Ajax” it makes conflict with the "global $post;" type in the short code functions. Wordpress doesn’t support Ajax with "global $post;". We advise to modify the short code you have and use the following one:

function ck13_fbgm_terms($atts) {
global $post;
if (!empty($_POST['acp_pid'])) {
$id = $_POST['acp_pid'];
}
else{
$id = $post->ID;
}

extract(shortcode_atts(array(
'ck_term' => '',
'ck_sep' => ', ',
'ck_before' => '',
'ck_after' => ''
), $atts));

$show_the_terms = "";
$show_the_terms .= get_the_term_list($id, "$ck_term", "$ck_before", "$ck_sep", "$ck_after");
return $show_the_terms;
}

function register_shortcodes() {
add_shortcode('fbgm-terms', 'ck13_fbgm_terms');
}

add_action('init', 'register_shortcodes');


ReplyQuote
CK13
 CK13
(@CK13)
New Member
Joined: 7 years ago
Posts: 4
Topic starter  

Great.
Thanks.


ReplyQuote
Share:
Scroll to top