Pulling Perch regions into blog pages. Can this be done?

  • Hello,


    Been following the video series and already my head is confused.


    Basically I have a page I have created with all the usual blog bits.


    Post header

    --------------------

    Author

    --------------------

    date

    --------------------

    Post content | Side bar for articles / categories

    --------------------


    My question is this. Can I not just grab already made pieces of perch php function script and just do the following to make it work?


    Post header

    --------------------

    perch_blog_author_for_post()

    --------------------

    date can't find a script that just outputs a simple 00/00/00 format. Only the functions show have archive and links I don't want this.

    --------------------

    <?php perch_blog_post(perch_get('s')); ?> |<?php perch_blog_post_categories(perch_get('s')); ?>

    --------------------


    I can get all the fields displaying but it is coming from the post.html template i think, which is spitting out all data into the post body which I don't want. I want it in broken down into the areas above.


    How do I do this?

  • drewm

    Approved the thread.
  • perch_blog_author_for_post(); uses the /perch/templates/blog/author.html template.

    perch_blog_post(perch_get('s')); uses the /perch/templates/blog/post.html template.

    perch_blog_post_categories(perch_get('s')); uses the /perch/templates/blog/post_category_link.html template.


    You can always create your own template and use it. For the blog post, you have to use perch_blog_custom as follows:

    Code
    1. perch_blog_custom([
    2. 'filter' => 'postSlug',
    3. 'match' => 'eq',
    4. 'value' => perch_get('s'),
    5. 'template' => '[YOUR_TEMPLATE.html]',
    6. ]);
  • When you turn on debug, by placing define('PERCH_DEBUG', true); in the /perch/config/config.php file, and outputting the debug on the bottom of your page, you can see exactly which template is being used.

  • james595832

    Changed the title of the thread from “Blog problems” to “Pulling Perch regions into blog pages. Can this be done?”.