Skip Navigation

[Resolved] third party shortcode not working while ajax filtering

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Waqar 6 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#1119208

i have a yuzo related plugin installed
it counts each post views
i would like to add it to my view -, by their shortcode yuzo_views
it works fine - but when i filter results - it show the shortcode string and not the view counter value
any ideas?

#1120624

Hi Meirk,

Thank you for contacting us and I'll be happy to assist.

For further troubleshooting, we’ll need temporary access (WP-Admin and FTP) to your site ( preferably, to a test site where the problem has been replicated if possible ).

This access will allow us to offer better help and check if some configurations might need to be changed. Any screenshot(s) or details about the placement of the "yuzo_views" shortcode, will also prove very useful.

Your next answer will be private which means only you and our support team will have access to it.

If you're going to share the access details for the live/production website, it is very important that a complete backup of your database and website has been made.

We would additionally need your permission to deactivate and reactivate Plugins and the Theme and to change configurations on the site. This is also a reason the backup is really important.

Please let us know if you have any further information or questions.

regards,
Waqar

#1121385

Hi Meirk,

Thanks for writing back and for sharing the access details.

During troubleshooting, I noticed that the way Related Posts plugin's shortcode is designed, it is not compatible with AJAX filtering.

But you can get values of views directly from the plugin, using a custom shortcode:

1. Please add following code at the bottom of your active theme's "functions.php" file:


// custom shortcode to check if number of views directly from "Related Posts" plugin
add_shortcode('yuzo_views_custom', 'yuzo_views_custom_fn');
function yuzo_views_custom_fn($atts) {
   
	$a = shortcode_atts( array(
		'id' => ''
	), $atts );

	if ( class_exists('yuzo_related_post') ) {
   		return yuzo_related_post::yuzo_get_PostViews( $a['id'] );
   	}
   	else
   	{
   		return "The related post plugin is not active";
   	}
}

2. Next, you can update your View to get the view count as:


views: [yuzo_views_custom id="[wpv-post-id]"]

I hope this helps! Please let us know how it goes and if you need any further assistance.

regards,
Waqar

#1127063

bsd

thanks - it works!!
i need one more thing

how can i filter a view by this shortcode? (meaning i will filter the posts by view rank)

#1127473

Hi Meirk,

Thanks of the update and glad it worked.

The "Related Posts" plugin stores the information about the views count in form of a serialized data. For this reason, I'm afraid, there is no direct method to use values from it for filtering/ordering a Toolset View.

It may be possible to achieve using custom code, but complex custom programming like this is beyond the scope of our support.

You can consult one of our certified consultants, for a possibility of a custom project:
hidden link

If I can be of any further assistance, please let me know.

regards,
Waqar