Okay
  Public Ticket #1312156
Category.php file
Closed

Comments

  • yunyunmao started the conversation

    Hello,

    I'd like to customize the archive category page (insert a text zone before the post). 

    So I need the category.php or equivalent file but I'm not sure which one is in Kalium.

    Thanks a lot.

    Best regards.


  • [deleted] replied

    Hi yunyunmao

    Blog works with actions functions that can be override (hook) or edit them directly, the list below works as it is ordered.

    Blog Template

    //Open Container
    add_action( 'kalium_blog_archive_content', 'kalium_blog_archive_posts_column_open', 10 );
    //Start Loop - load elements
    add_action( 'kalium_blog_archive_content', 'kalium_blog_posts_loop', 20 );
    //Show Pagination
    add_action( 'kalium_blog_archive_content', 'kalium_blog_archive_posts_pagination', 30 );
    //Close Container
    add_action( 'kalium_blog_archive_content', 'kalium_blog_archive_posts_column_close', 40 );
    //Show Sidebar
    add_action( 'kalium_blog_archive_content', 'kalium_blog_sidebar_loop', 50 );
    

    Blog Items - the functions you have to hook to edit ( to add title, date , excerpt, category ), are listed below.

    /**
    * kalium_blog_loop_post_details hook
    *
    * @hooked kalium_blog_post_title - 10
    * @hooked kalium_blog_post_excerpt - 20
    * @hooked kalium_blog_post_date - 30
    * @hooked kalium_blog_post_category - 40
    */
    do_action( 'kalium_blog_loop_post_details' );
    

    How to create new function for your request - this is what you need. 

    /*
     * text before post
     */
    if  ( ! function_exists('kalium_blog_post_text')){
           function kalium_blog_post_text(){
               ?>
               Content before post item each
               <?php
           }
    }
    add_action('kalium_blog_loop_post_details','kalium_blog_post_text',8);
    

    Since your are inside loop you can call and ACF Field the_field('option'), or WP function such is the_title();

    Important notice number 8 means when the code will be executed since the title is number 10 is first so 8 is lower and will be executed early before title.

    Thank you.