Custom Post Cards
-
Hi,
I am currently trying to create a custom post layout for my smart filters and have been following the instructions but do not appear to be able to get it to work.
The instructions mention the required ID, and I have assumed that I am supposed to replace the _ID portion of the filter name with the internal ID of the filter I am targetting:
/** * Creating a custom post template * @param {string} layout - HTML markup * @param {int} post_id - Post ID * @param {int} filter_id - Filter ID * @returns {string} HTML markup card post */ function my_custom_post_layout($layout, $post_id, $filter_id) { $layout = '<h2>'.get_the_title($post_id).'</h2>'; $layout .= '<p>'.wp_trim_words(get_the_content($post_id), 30).'</p>'; $layout .= '<a href="'.get_the_permalink($post_id).'">Read More</a>; return $layout; } add_filter('ymc_post_custom_layout_ID', 'my_custom_post_layout', 10, 3);
Am I supposed to refactor the add_filter parameter to look something like:
add_filter('ymc_post_custom_layout_32245', 'my_custom_post_layout', 10, 3);
OR, do I pass the ID into the custom function call? i.e:
function my_custom_post_layout($layout, $post_id, "32245")
Apologies if this appears to be a stupid question, but I just cant get it to work!
Many thanks in advance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Post Cards’ is closed to new replies.