Post templates

This topic contains 6 reply and 2 voices, and was last updated by Nicolas 9 years, 12 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
April 22, 2014 at 5:33 pm 19230
Nicolas I want to define a post template to new form posts and I don't see the option. Is there any way to do it? Thanks
April 22, 2014 at 7:23 pm 19235
Oritro Ahmed Oritro Ahmed

Hi Nicolas,

Its Quite easy. Whenever you are Building or Editing a From, You will find a Post Settings Tab there. Go there, and You will find a Select box for Post Type. You Can define your desired post type.

For A Better Understanding, Here is a Screenshot,

Enlarged View

April 22, 2014 at 7:51 pm 19239
Nicolas Nicolas

That’s about post types but not post templates.
I’ve a single.php and a single2.php (with small diferences in author bx) formats and that’s what I want to define.
I would like to know if the post format can be changed, because I only have -NONE- option and meybe it can be my solution.

April 22, 2014 at 8:16 pm 19240
Oritro Ahmed Oritro Ahmed

My point was, You can Assign a Specific Post Type to a Specific Template, Then you can call it from here !

April 22, 2014 at 8:45 pm 19242
Nicolas Nicolas

But I dont want users to post custom types, because of the architecture of my site, I prefer to use template posts.
That’s because if I do post types, when I go to a users posts I will see 0 results of posts.

April 22, 2014 at 9:05 pm 19244
Oritro Ahmed Oritro Ahmed

Well Nicolas, There is only one Legitimate Way to Solve this problem.

Create a Hidden Field on the form, Specify a Fixed value for that. Now while viewing the post, fetch that value and use it to determine the Template. Like a Conditional template.

Hopefully that will help you.

April 22, 2014 at 9:52 pm 19246
Nicolas Nicolas

Sorry but i don’t understand it.
What I’m trying now is a total diferent way to get what i want.
I want to show author box only for non admin users (or some roles) and that’s why I was doing a post template only for authors with author box.

Now I’m tring to get a php code to show author box only if the post author role is Author.
Maybe you can help me, i’m trying this code but i cant get to work

<?php 
global $wp_query;
$roles = $wp_query->queried_object->roles;
if( $roles[0] == 'author' ) {?>

 <h4 class="author_box_title"><?php _e('About The Author', 'theme'); ?></h4><?php
echo do_shortcode('[upme id=author]');
?>
    <?php } ?><?php }?>

Thanks

Viewing 6 Posts - 1 through 6 (of 6 total)