Notifications
Clear all

Shortcodes not working inside [nextpage] tag

7 Posts
3 Users
0 Reactions
3,391 Views
 CK13
(@CK13)
New Member
Joined: 11 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
(@tomson)
Famed Member Admin
Joined: 10 years ago
Posts: 4214
 

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


   
ReplyQuote
 CK13
(@CK13)
New Member
Joined: 11 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
(@tomson)
Famed Member Admin
Joined: 10 years ago
Posts: 4214
 

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


   
ReplyQuote
(@gagik)
Active Member Admin
Joined: 9 years ago
Posts: 13
 

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)
New Member
Joined: 11 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)
Active Member Admin
Joined: 9 years ago
Posts: 13
 

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)
New Member
Joined: 11 years ago
Posts: 4
Topic starter  

Great.
Thanks.


   
ReplyQuote
Share:
Scroll to top