• Resolved gtaranti

    (@gtaranti)


    How can I override the php template file for the output of each related post item?

    Is it in the child’s functions.php ?
    Or in some other place?

    I ask this question, because I need some more info in the related post item, such as Post Date and Post Categories.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ajay

    (@ajay)

    You can use the API functions for this. See this example – https://gist.github.com/ajaydsouza/968b24a052e858bf8926

    Thread Starter gtaranti

    (@gtaranti)

    OK, I see.

    A little help here., please :

    When I use the shortcode (e.g. [crp limit=”3″ heading=”1″ cache=”1″] ) which php file I need to override and where to put my file in order to perform custom output ?

    Thanks

    Thread Starter gtaranti

    (@gtaranti)

    Never mind, I used your crp_custom_template filter to override the default template.

    Nice functionality. Thanks!

    Plugin Author Ajay

    (@ajay)

    Glad to know that worked – do you mind sharing that code in case other users find it helpful? I’m yet to see examples around that being used publicly!

    Thread Starter gtaranti

    (@gtaranti)

    Sure.

    I just overrode the standard template of the plugin by adding a filter to the crp_custom_template in my theme’s child functions.php like this :

    add_filter('crp_custom_template', 'diane_crp_template', 10, 3);

    Then also in my functions.php I copied the contents of the functions get_crp() (I renamed it diane_crp_template()) and crp_list_link() of the file main-query.php and customised them as necessary.
    I also created my own CSS.
    I wanted to create related posts for recipes posts.

    The results : Link-1 and Link-2

    • This reply was modified 6 years, 6 months ago by gtaranti.
    Plugin Author Ajay

    (@ajay)

    Thanks – definitely helpful!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Template override’ is closed to new replies.