Category Related Post

Install pro version

How to upgrade pro version? Install free version of Related Post first. please download plugin from this link Then install pro version by downloading from our website, you can get plugin zip file from My account > Downloads  Free…

How to activate license?

How to activate license? After installing pro version of plugin you will see the license under settings navs. Please follow this link to get your license keys Copy your license key and paste on settings input field and then…

Remove related posts from any post

You can remove the related post from any post by action hook, please see the code sample, note the variable  $excluded_posts add your posts ids you want to exclude add_action(‘related_post_main’, ‘remove_related_posts’, 2); function remove_related_posts(){ if(is_singular(array(‘post’))){ $excluded_posts = array(1749,1234); $post_id =…

related_post_element_link_attrs

You can add custom attributes for each link. add_filter(‘related_post_element_link_attrs’,’related_post_element_link_attrs_20200126′, 10, 2); function related_post_element_link_attrs_20200126($elementIndex, $elementData) { $option_id = isset($elementData[‘option_id’]) ? $elementData[‘option_id’] : ”; if($elementIndex == ‘post_title’){ echo ‘data-attr=”hello-data”‘; } }  

related_post_element_css_$id

You can hook custom CSS for each element add_action(‘related_post_element_css_custom’,’related_post_element_css_custom_20200126′); function related_post_element_css_custom_20200126($elementData) { //$option_id_value = isset($elementData[‘option_id’]) ? $elementData[‘option_id’] : ”; $margin = isset($elementData[‘margin’]) ? $elementData[‘margin’] : ’10px’; ?> .related-post .post-list .item .post_title{ margin: <?php echo $margin; ?> } <?php }  

related_post_loop_item_element_$id

Action hook for each element post_title add_action(‘related_post_loop_item_element_post_title’,’related_post_loop_item_element_post_title_20200126′, 10, 2); function related_post_loop_item_element_post_title_20200126($loop_post_id, $elementData) { //$option_id_value = isset($elementData[‘option_id’]) ? $elementData[‘option_id’] : ”; //$post_meta_value = get_post_meta($loop_post_id, ‘meta_key’, true); ?> Element HTML for post_title <?php //echo $option_id_value; ?> <?php }   post_thumb add_action(‘related_post_loop_item_element_post_thumb’,’related_post_loop_item_element_post_thumb_20200126′, 10,…

related_post_loop_item

Display custom HTML under item class. add_action(‘related_post_loop_item’,’related_post_loop_item_20200126′, 0); function related_post_loop_item_20200126($atts) { $loop_post_id = isset($atts[‘loop_post_id’]) ? (int) $atts[‘loop_post_id’] : get_the_ID(); ?> Custom HTML for item <?php }   View post on imgur.com   Remove hook add_action(‘related_post_loop_item’,’related_post_loop_item_remove_20200126′, 0); function related_post_loop_item_remove_20200126($loop_post_id) { remove_action(‘related_post_loop_item’,’related_post_loop_item’);…

related_post_main

Action hook for related post main. add_action(‘related_post_main’,’related_post_main_20200126′); function related_post_main_20200126() { ?> Custom HTML before related post area. <?php } View post on imgur.com   Remove default hook add_action(‘related_post_main’,’related_post_main_remove_hook_20200126′, 0); function related_post_main_remove_hook_20200126() { remove_action(‘related_post_main’,’related_post_main_title’); remove_action(‘related_post_main’,’related_post_main_post_loop’); remove_action(‘related_post_main’,’related_post_main_css’); remove_action(‘related_post_main’,’related_post_main_slider_scripts’); } Remove related posts…

related_post_query_args

You can add custom arguments via filter hook as following. add_filter(‘related_post_query_args’,’related_post_query_args_20200126′); function related_post_query_args_20200126($args) { $args[‘s’] = ‘Template’; // search term return $args; }