Tagged: 

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #476372

    how can I have template file for “POST”? I want to add some custom code for post (not page). How can I do that or which file should I update? single.php?

    Remark: I am using child theme

    #476578

    Hey boscotwcheung!

    basically you would need to look for archive.php and single.php. For more info: https://codex.wordpress.org/Post_Type_Templates

    However, I think you could achieve that with a plugin like this: https://wordpress.org/plugins/wp-custom-post-template/

    Best regards,
    Andy

    #477491

    I tried to add single.php and archive.php into my child theme. However, both files didn’t loaded for post.

    I also tried the custom post template plugin. I can see there is a widget title “WP Post Template” in the wp admin page. But there is nothing in it.

    #478060

    Anyone can help? Even I update the single.php in the parent theme. It doesn’t seems to be loaded at all. Which is the template file for a normal post layout?

    Thanks,
    Alex

    #478876

    Hey!

    Could you please provide us with a temporary admin login so that we can take a closer look? You can post the details in the Private Content section of your reply.

    Regards,
    Rikard

    #478911
    #479429

    Hey!

    The template for the single post page is the includes > loop-index.php file. To test it, try to remove the code inside this file then check one of the single post items. The post should be blank.

    Cheers!
    Ismael

    #480510

    No. It doesn’t work. I tried to create an empty loop-index.php into child theme and also tried to delete all the code inside loop-index.php in parent theme. Both are not working. It still shows posts content as normal.

    #481740

    Hi!

    Are you using the Enfold Advanced Layout Builder in one of the Posts you are trying to modify?

    Best regards,
    Josue

    #481933

    Yes.

    #482318

    Well, that explains it. ALB uses another template file (template-builder.php), what do you want to change exactly?

    Regards,
    Josue

    #482541

    I want to make 2 homepage originally. One is for logged user and the other one is for visitor. I want to make a auto redirect if visitor is trying to view the logged homepage and also redirect the logged user from visitor homepage to logged homepage.

    I found a plugin to add php code as a shortcode to the Enfold text element to handle this case. However, I still interested to see if I can do it in 2 template files for both homepage with the Enfold Advanced Layout editor.

    #482998

    Hey!

    You could have a version of template-builder.php in your child theme directory and modify it there.

    Cheers!
    Josue

    #483065

    but I can only have one template-builder.php for all pages or posts in child theme, right?

    #483104

    Hey!

    Yeah, template-builder is used for both Posts and Pages but you could make use of Conditional Tags to detect what kind of content is being shown:
    https://codex.wordpress.org/Conditional_Tags

    Best regards,
    Josue

    #483123

    ok. I got it. Thanks!

    #483132

    You are welcome, glad to help :)

    Regards,
    Josue

    #505286

    I think this can be closed. Thanks.

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