Title: Custom Layout Function Help
Last modified: March 14, 2023

---

# Custom Layout Function Help

 *  Resolved [Christopher McMahon](https://wordpress.org/support/users/cmcmahon/)
 * (@cmcmahon)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/)
 * This is the code I have in my theme’s functions.php
 *     ```
       function func_custom_layout($layout, $post_id, $filter_id, $increment_post) {  
       	   $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_545_ID", "func_custom_layout", 10, 5);
       ```
   
 * But as you can see at the supplied link, it doesn’t seem to be working. Any help
   would be great. Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-layout-function-help%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16559902)
 * Hello!
   You need to write in the name of the filterymc_post_custom_layout_FilterID_LayoutID–
   where:
    - FilterID – this is the ID of the post shortcode.
    - LayoutID – this is the index number of the filter on the page
      So, for example,
      you have a FilterID – this is 545, you will need to look at the serial number
      of the filter on the page (ID). If you have only one filter on the page, then
      the serial number will be 1 and your filter will look like this:add_filter(‘
      ymc_post_custom_layout_545_1’, ‘my_custom_post_layout’, 10, 5);Here, for example,
      see the screenshot where there are three filters on the page and here the 
      serial numbers (LayoutID) and FilterID are different.
    - [https://drive.google.com/file/d/1uU6x-kSeNlTaVXc1o6sQxIIscInCXTPa/view?usp=share_link](https://drive.google.com/file/d/1uU6x-kSeNlTaVXc1o6sQxIIscInCXTPa/view?usp=share_link)
      
      I hope we were able to help you.
 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16559917)
 * add_filter(‘ymc_post_custom_layout_545_1’, ‘my_custom_post_layout’, 10, 5);
 * [https://drive.google.com/file/d/1q6aOu4H30uuf0hbzGqjvTDGUI0ZbJYPU/view?usp=share_link](https://drive.google.com/file/d/1q6aOu4H30uuf0hbzGqjvTDGUI0ZbJYPU/view?usp=share_link)
 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16559936)
 * Let us know if you managed to solve your issue.
 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16560571)
 * If you have any questions, please contact.
 *  Thread Starter [Christopher McMahon](https://wordpress.org/support/users/cmcmahon/)
 * (@cmcmahon)
 * [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16561764)
 * Yes, that worked. Thank you very much

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom Layout Function Help’ is closed to new replies.

 * ![](https://ps.w.org/ymc-smart-filter/assets/icon-128x128.png?rev=3354891)
 * [YMC Filter](https://wordpress.org/plugins/ymc-smart-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ymc-smart-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ymc-smart-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/ymc-smart-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ymc-smart-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ymc-smart-filter/reviews/)

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [layout](https://wordpress.org/support/topic-tag/layout/)

 * 6 replies
 * 2 participants
 * Last reply from: [Christopher McMahon](https://wordpress.org/support/users/cmcmahon/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/custom-layout-function-help/#post-16561764)
 * Status: resolved