• Resolved Christopher McMahon

    (@cmcmahon)


    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 to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YMC

    (@wssoffice21)

    Hello!
    You need to write in the name of the filter
    ymc_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
      I hope we were able to help you.
    Plugin Author YMC

    (@wssoffice21)

    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

    Plugin Author YMC

    (@wssoffice21)

    Let us know if you managed to solve your issue.

    Plugin Author YMC

    (@wssoffice21)

    If you have any questions, please contact.

    Thread Starter Christopher McMahon

    (@cmcmahon)

    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.