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

    (@wssoffice21)

    Hi! You should use custom layout to create your own post card layout. Use a filter for this, for example:
    add_filter(‘ymc_filter_custom_layout_545_1’, ‘my_custom_filter_layout’, 10, 6);
    Refer to the plugin documentation – https://github.com/YMC-22/smart-filter

    Thread Starter mansisavarkar2105

    (@mansisavarkar2105)

    Hi

    Thanks for the reply. For testing I have used your code and replaced filterID and LayoutID. But it gives error. Not showing whole error. Whole site gets down. For refernce I have added code. could u check and let me know what mistake is there.

    function my_custom_post_layout($layout, $post_id, $filter_id, $increment_post, $arrOptions) {  

        $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_4488_1’, ‘my_custom_post_layout’, 10, 5);

    Plugin Author YMC

    (@wssoffice21)

    Please send a link to the page of your site where you use the plugin. It’s very difficult to determine what could be wrong…

    Thread Starter mansisavarkar2105

    (@mansisavarkar2105)

    Plugin Author YMC

    (@wssoffice21)

    We have checked your code and would like to report that filtering is working correctly. Our plugin does not generate any errors and posts are filtered correctly according to the specified parameters (see screenshot – https://prnt.sc/JxLPsvV1UC0Z).
    Here we see the appearance of errors in the scripts of your site, which are most likely caused by other installed plugins or perhaps. custom scripts. In addition, clear the cache on your server since the site works with WPEngine, and this is a cached server.

    Thread Starter mansisavarkar2105

    (@mansisavarkar2105)

    No actually you misunderstood. I am not talking about filtering. I want to add custom layout so that I can give link to whole grid with respective post link. But the code I have given isn’t working giving error. Need to add image as well but this simple code is not working.

    Let me know you understand my question or not.

    Thanks

    Plugin Author YMC

    (@wssoffice21)

    You are already using a custom layout here to display grid of posts and filtering works correctly. To add an image to a post card, use the standard WordPress functions for displaying an image. Therefore, the example code that was given above works correctly… or perhaps we don’t fully understand your issue. What error does this code display? From our side we see nothing…

    • This reply was modified 2 years ago by YMC.
    Thread Starter mansisavarkar2105

    (@mansisavarkar2105)

    Can you check now why it is showing like that?

    https://atechcloudstg.wpengine.com/webinar/

    Plugin Author YMC

    (@wssoffice21)

    remove the dots when assigning to the $layout variable – https://prnt.sc/b6g3JSdCzAur
    it should be like this:
    function my_custom_post_layout($layout, $post_id, $filter_id, $increment_post, $arrOptions) {

     $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;

    }

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

The topic ‘Add link to post’ is closed to new replies.