This topic has 19 replies, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #69436
     wilfriedMarseille
    Participant

    Hello.
    I try to understand how to add a post layout to customise my articles. But i don’t know how to do that …

    If you love Ableton check my blog :
    www.zikrea.com

    #69444
     sharmstr
    Moderator

    You have two options

    1 – Enable visual composer for posts. If you do that, you may want to turn off ‘display media on posts’. You’ll also have to use custom posts excerpts.

    2 – If you know php and wordpress templating, you can edit the template files.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #69454
     wilfriedMarseille
    Participant

    Yes i know php and wordpress templating. I’m gone in KLEO > Page Template and i add a ful-with2.php

    I can select it for page but no for articles.
    Where is the folder with article template please ?

    If you love Ableton check my blog :
    www.zikrea.com

    #69455
     sharmstr
    Moderator

    There’s not just one file. They are broken up into several files depending on what layout AND post format you have selected.

    Put this in your child theme functions.php file. It will put comments in your page source code that will tell you which template files are being called.

    COPY CODE
    
    /**
     * show included template files
     */
    add_action('all','template_snoop');
    function template_snoop(){
        $args = func_get_args();
        if( !is_admin() and $args[0] ){
            if( $args[0] == 'template_include' ) {
                echo "<!-- Base Template: {$args[1]} -->\n";
            } elseif( strpos($args[0],'get_template_part_') === 0 ) {
                global $last_template_snoop;
                if( $last_template_snoop )
                    echo "\n\n<!-- End Template Part: {$last_template_snoop} -->";
                $tpl = rtrim(join('-',  array_slice($args,1)),'-').'.php';
                echo "\n<!-- Template Part: {$tpl} -->\n\n";
                $last_template_snoop = $tpl;
            }
        }
    }
    

    Just view the page source and search for “Template Part” to see all the template files the page has called. See attached example

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    Attachments:
    You must be logged in to view attached files.
    #69463
     wilfriedMarseille
    Participant

    I have to check this tomorrow because i have to go Work.
    Thanks you 🙂

    If you love Ableton check my blog :
    www.zikrea.com

    #69464
     wilfriedMarseille
    Participant

    And how we enable visual composer for post ?

    If you love Ableton check my blog :
    www.zikrea.com

    #69467
     sharmstr
    Moderator

    Visual Composer > General Settings

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #69474
     wilfriedMarseille
    Participant

    Very good support !!!! The 25 of month i got my money i’m not super rich but i would like give a little donnation of 10$ because you are a great team. It’s a plesaure to develop project with you. I have to go out now. I’m going to search the donation button the 25 but if you got a link is better :).
    Thanks you.

    O and I did’nt make my article template. But when I will make it. Can I save it in the Post Layout ? If yes how we do that ?
    Thanks again 🙂

    If you love Ableton check my blog :
    www.zikrea.com

    #69480
     wilfriedMarseille
    Participant

    So i put the visual composer for post an article.
    But in reality my problem is already here because i want change the place of authors meta data, i don’t want see all the information but just the name, add a button like / Disslike or a star notation systeme.
    And with the visual composer i see only the text edit, no the others parts like social share …

    So if i have understand I have to edit a template files with PHP. And to do this I have to edit more than 1 files because it use template part ?
    But i don’t understand wich files i have to create to make a post template.

    If you love Ableton check my blog :
    www.zikrea.com

    #69609
     sharmstr
    Moderator

    As I mentioned before, add the code I gave you. It will tell you which pages you need to either change or copy and customize.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #69615
     sharmstr
    Moderator

    You can also look at single.php. That’s the template that’s used for posts. You’ll see in there the other templates that are used to build the page. For example, just before the loop it calls out one of the content templates depending on the post format that has been selected. Lets say it was an image post. Then you’d open up content-image.php.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70352
     wilfriedMarseille
    Participant

    Hello
    When I put you code in the child KELO > function.php I get an error when a refresh my page :

    Parse error: syntax error, unexpected ‘}’ in /homepages/3/d556184796/htdocs/le-journal-des-dj-producteurs/wordpress/wp-content/themes/kleo-child/functions.php on line 33

    If you love Ableton check my blog :
    www.zikrea.com

    #70364
     wilfriedMarseille
    Participant

    Sorry it’s an error of Me …
    But I put the code `/**
    * show included template files
    */
    add_action(‘all’,’template_snoop’);
    function template_snoop(){
    $args = func_get_args();
    if( !is_admin() and $args[0] ){
    if( $args[0] == ‘template_include’ ) {
    echo “<!– Base Template: {$args[1]} –>\n”;
    } elseif( strpos($args[0],’get_template_part_’) === 0 ) {
    global $last_template_snoop;
    if( $last_template_snoop )
    echo “\n\n<!– End Template Part: {$last_template_snoop} –>”;
    $tpl = rtrim(join(‘-‘, array_slice($args,1)),’-‘).’.php’;
    echo “\n<!– Template Part: {$tpl} –>\n\n”;
    $last_template_snoop = $tpl;
    }
    }
    }`
    And when i look the source code, the template parrts are not inside.

    If you love Ableton check my blog :
    www.zikrea.com

    #70378
     sharmstr
    Moderator

    You have fancy quotes in your code. Copy my code again, making sure the single and double quotes dont change.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70379
     sharmstr
    Moderator

    Looks like there is a new plugin that basically does the same thing. I havent tried it https://wordpress.org/plugins/show-current-template/screenshots/

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70397
     wilfriedMarseille
    Participant

    thanks you with the plug in it’s great 🙂

    If you love Ableton check my blog :
    www.zikrea.com

    #70398
     wilfriedMarseille
    Participant

    And is possible to make a article second.php to get a second type of post. With some differents. And choose the second template in the post layout of the dashboard ?

    If you love Ableton check my blog :
    www.zikrea.com

    #70399
     sharmstr
    Moderator

    I thought you said you know wordpress templating? To answer your question, yes you can.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70401
     wilfriedMarseille
    Participant

    Yes I know WordPress templating but, page template, no post layout template …

    If you love Ableton check my blog :
    www.zikrea.com

    #70404
     sharmstr
    Moderator

    They work the same. Google it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 20 posts - 1 through 20 (of 20 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?