Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    This is going to be something that needs to be done at the template/theme level with your active theme. I recommend duplicating your archive.php and single.php files and append the post type slug after them. For instance, if you have the post type of “movie”, you’d make archive-movie.php and single-movie.php. That way your post types get dedicated template files loaded and you could safely remove the timestamps/authors for them, while regular posts retain.

    Thread Starter webcraftuk

    (@webcraftuk)

    OK, I think I understand the general thrust of your reply, but not entirely . . . sorry to be a bit dense.

    Two things:

    a) I cannot see the author stamp and timestamp in either of these files in my theme (see code below)

    b) How do I ensure that the post type loads the dedicated template file? Surely just creating the newly named files will not be enough?

    file: archive-boat.php :

    <?php get_header(); ?>
    <?php // Get Theme Options from Database
    	$theme_options = airballoon_theme_options();
    ?>
    	<div id="wrap" class="clearfix">
    		<section id="content" class="primary" role="main">
    		<h2 id="date-title" class="archive-title">
    			<?php // Display Archive Title
    			if ( is_date() ) :
    				printf( __( 'Monthly Archives: %s', 'airballoon-lite' ), '<span>' . get_the_date( _x( 'F Y', 'date format of monthly archives', 'airballoon-lite' ) ) . '</span>' );
    			else :
    				_e( 'Archives', 'airballoon-lite' );
    			endif;
    			?>
    		</h2>
    		<?php if (have_posts()) : while (have_posts()) : the_post();
    			get_template_part( 'content', $theme_options['posts_length'] );
    			endwhile;
    		airballoon_display_pagination();
    		endif; ?>
    		</section>
    		<?php get_sidebar(); ?>
    	</div>
    <?php get_footer(); ?>

    file single-boat.php:

    <?php get_header(); ?>
    	<div id="wrap" class="clearfix">
    		<section id="content" class="primary" role="main">
    		<?php if (have_posts()) : while (have_posts()) : the_post();
    			get_template_part( 'content', 'single' );
    			endwhile;
    		endif; ?>
    		<?php comments_template(); ?>
    		</section>
    		<?php get_sidebar(); ?>
    	</div>
    <?php get_footer(); ?>

    Thanks for your help with this, much appreciated.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    They’re probably coming from the get_template_part() calls, which are likely loading content.php and content-single.php. A detail I always forget.

    I assume you’re going to use the same loop output for both, so it’d be easy to make a content-boat.php from one of the two content files mentioned above. and then in both single-boat.php and archive-boat.php, change

    get_template_part( 'content', 'single' );
    get_template_part( 'content', $theme_options['posts_length'] );

    to

    get_template_part( 'content', 'boat' );

    Hopefully I’m staying within making sense ??

    Thread Starter webcraftuk

    (@webcraftuk)

    NO, sorry, now I am hopelessly confused.

    Could you please do me an idiots guide as a simple list of steps I need to take ?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    make a copy of content.php and name it content-boat.php.

    In archive-boat.php change this line:

    get_template_part( 'content', $theme_options['posts_length'] );

    to

    get_template_part( 'content', 'boat' );

    In single-boat.php change this line:

    get_template_part( 'content', 'single' );

    to

    get_template_part( 'content', 'boat' );

    Now, edit content-boat.php to your hearts content, removing and adding parts you want to.

    Thread Starter webcraftuk

    (@webcraftuk)

    Thank you so much Michael.

    This seems to be working perfectly.

    Thread Starter webcraftuk

    (@webcraftuk)

    OK, now I am stuck again. I don’t understand how taxonomies work and how you query/display them.

    I assumed that they were a way of sorting custom posts in the same way categories work for normal post types, and that I could display all custom posts in a particular taxonomy in the same way I could display all posts in a particular category.

    For example – I have a taxonomy ‘Sleeps up to 8’ which is attached to Post Type – Boats

    What URL (if any) will display only Boats in the Sleeps up to 8 taxonomy?

    (There’s a wee PayPal donation coming your way if I can eventually get my head round this, as it is a feature of WordPress I have been struggling with for a while now that could prove very useful)

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    To be technical, none of the questions are related to our plugin, as we don’t do anything with the content display/querying. But I try to help out when I can anyway.

    There’s no all-taxonomy archive url that I’m aware of with WordPress. When it comes to taxonomies, they only do archives by term. For example: domain.com/taxonomy_slug/term_slug/ That would show all of the posts with that term. However domain.com/taxonomy_slug/ won’t do anything.

    “Sleeps up to 8” sounds like it’d be better as a term in a taxonomy, instead of the taxonomy itself. Perhaps use the taxonomy of “amenities”.
    If the taxonomy is isolated to just the one post type, then a url like domain.com/amenities/sleeps-up-to-8/ would show all of the boats that has that term.

    Thread Starter webcraftuk

    (@webcraftuk)

    I’ve been reading up about terms but I don’t understand how terms are added to a taxonomy – the plugin does not seem to offer this function in any of its screens.

    Do I have to add the terms to a taxonomy manually, and how do I add them to custom posts?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The same way you add categories and tags to blog posts, except on the editor screen for the post type. “Category” and “tag” in WordPress are taxonomies created out of the box for you. A tag of “baking” is a term for the tag taxonomy. The behavior of your custom taxonomy will depend on if it’s been set to be hierarchical or not. If it is hierarchical, it’ll behave more like categories where terms can have parent/child relationships. Non-hierarchical will be more like tags.

    Thread Starter webcraftuk

    (@webcraftuk)

    My editor screen for a custom post does not show anywhere to add terms, it only allows me to add the post to one of the taxonomies I have created.

    I am tearing my hair out with this. Is there any way I can get categories and tags to show with my custom posts, as I know how to use them.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Add both of them as supported taxonomies for the post type you created. However, based on what you’ve said above, you’re already where you need to be, with that “it only allows me to add the post to one of the taxonomies I have created” part. If you have a metabox for that taxonomy along the right side, that’s what you use.

    Remember “Category” and “Tag” are their own taxonomies, and this whole time you’ve been adding terms to both, and it’s going to be the exact same with your custom ones.

    Thread Starter webcraftuk

    (@webcraftuk)

    I have a metabox which allows me to add a post to one of the taxonomies I have created, but there is no ‘Terms’ box (equivalent of the Tags box) and there seems no point in adding a post to a taxonomy if it is not searchable or listable.

    (I can’t help thinking I am missing something obvious ?? )

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    We’ll use this screenshot as an example: https://cloudup.com/ci0rQyjOQIA

    If your taxonomy is set to be non-hierarchical, it should look like the “Event” box at the top of the image. It’ll behave like tags, I added those 3 at the same time, by simply being comma separated.

    If your taxonomy is set to be hierarchical, it should look like the “Language” box on the bottom of the image. I can create languages that have parent languages.

    If your custom taxonomy looks like neither of those, then something is going on that would need further debugging. Otherwise, you should be good to go already and assigning terms to the post.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Remove timestamp and author on custom posts’ is closed to new replies.