-
Author
-
August 21, 2014 at 16:30 #26323sharmstrModerator
What’s the best way to add your item likes to custom post types? I can easily do it by adding the custom post type to the $post_types array in the show_likes function in item-likes.php, but the obvious problem is that it will be overwritten during a Kleo upgrade.
Specially I’m working on adding it to the posts footer. I tried changing do_action(‘kleo_post_footer’) to do_action(‘story_post_footer’), then adding the following to my functions.php file. (btw – fiction is the custom post type below)
COPY CODEadd_action('story_post_footer', array(&$this, 'show_story_likes')); function show_story_likes() { $ids = str_replace(' ', '', trim(strip_tags(sq_option('likes_exclude')))); $ids = explode(',', $ids); if(in_array(get_the_ID(), $ids)) return; $post_types = array( 'post', 'attachment','fiction' ); $post_types = apply_filters( 'kleo_likes_post_types', $post_types ); $current_post_type = get_post_type(); if( in_array( $current_post_type, $post_types ) ) { echo $this->do_likes(); } }
This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
September 8, 2014 at 22:25 #28047AbeKeymasterHi, I think all you need to do is add this in your child theme in functions.php
COPY CODEadd_filter('kleo_likes_post_types', 'kleo_my_custom_like'); function kleo_my_custom_like( $post_types ) { $post_types[] = 'fiction'; return $post_types; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.September 8, 2014 at 22:42 #28051sharmstrModeratorIt works perfectly. Thank you, Abe.
I just learned something too. This is awesome. Thank you again.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.