In older themes like twentyfourteen I see category.php and tag.php.
However, in newer themes I only see archive.php.
If I change (or put in some php in) this file, both the category-pages of my site and the tag-pages change.
Question: How do I make changes for tag-pages only?
]]>The site I’m developing uses a custom loop, with a query that excludes any posts ticked as archived.
The reason I want to edit the tag.php template is to output custom meta to the front end, and tweak the appearance of all posts on the archive pages.
It works perfectly for the majority of the site, but on tag.php it causes to tag cloud to break, making any and every tag clicked bring up the full post list.
When I remove the query the tag cloud works fine, but archived posts are still displayed and aren’t laid out the way they need to be.
The query code I’m using is:
// The Queries
$args = array(
'post_type' => array('post', 'report', 'analysis', 'guest-blog'),
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'epi_pubarchive',
'value' => 1,
'compare' => '!=',
)
)
);
$the_query = new WP_Query( $args );
The meta key, epi_pubarchive, is a checkbox created using Meta Box, essentially checking if the box is ticked or not.
I’ve tried removing the meta_query and trying it with the basic post_type and order args, but that won’t work either.
Anyone know what the issue with tags and queries is?
Is there a better way to achieve the desired result?
]]>I want to make 2 links from this page to two separate pages showing all posts and all videos with pagination. Urls I want should be ‘/tag/slug/posts/’ and ‘/tag/slug/videos/’. Looks like 3rd part of url should be read by wordpress router as GET-variable so in tag.php I could do something like:
if ($_GET['type'] == 'posts') {
//output posts
}else if ($_GET['type'] == 'videos') {
//output videos
}else{
//default output
}
How to do it? Or maybe there is something easier I don’t know?
]]>I’m cleaning up my site and right now I’m on the /tag/ pages. They (right now) only show all my articles regarding the TAGs. What I want to do is the following:
On each tag-page (i.e. https://fosm.de/tag/port-ellen/) show all articles AND pictures with this tag.
I found the Shortcode for Filtering on tags in your docu. It would read like this for me:
[wppa type="slide" album="#tags,tag1" size="auto" align="center"][/wppa]
Where tag1 is the Tag regarding the actual tag-Page.
If I enter this code into the description it is not working. You mentioned that this has to sit in the LOOP. The description is used in the HEADER in my theme.
Can I adjust my tag.php to do the following:
CASE #ofpictures
= 0 => do not show anything
= 1 => show only one picture (not the slideshow)
>1 => slide
Best would be to have this at the end of all articles shown (but first page if pagination).
i.e.: https://fosm.de/tag/port-ellen/
Pictures should show up before the closing Text “FoSM – Friends of Single Malt – ist ein deutschsprachiger Blog rund um Single Malt Whisky….”
Doing it in the tag.php would mean to have a generic solution.
Thank you for your advise.
Best regards
Peter
BTW: using wppa+ 5-4-24-001
https://www.ads-software.com/plugins/wp-photo-album-plus/
Please help!
Ellen
]]>The problem Im running into is that tag.php loads the title from the individual post, not that of the projects page.
Also the list on tag.php is not updating to show only the tags selected.
This is the code I’m using for both the projects page and tag.php, minus the template name. I’m not sure what I should be changing on tag.php to make this work. Any advice appreciated, thanks,
<?php
/*
Template Name: Projects Page
*/
?>
<?php get_header(); the_post(); ?>
<div class="left">
<div class="header-shadow">
<div class="header-bg">
<p class="header-text"><?php the_title(); ?></p>
<p class="sub-header-text-gray"><?php echo get_post_meta($post->ID, 'description', true); ?></p>
</div>
</div>
<div class="content-wider">
<div class="project-tags-holder">
<span class="project-tags">Sort By:</span>
<span class="project-tags"><a href="?page_id=8">All</a></span>
<?php
$tags = get_tags( array('orderby' => 'count', 'order' => 'DESC') );
foreach ( (array) $tags as $tag ) {
echo '<span class="project-tags"><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . ' (' . $tag->count . ') </a></span>';
}
?>
</div>
<?php
$args = array('category' => '5', 'posts-per-page=5'.'&paged='.$paged);
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<div class="projects-list">
<div class="projects-img"><img src="<?php echo get_post_meta($post->ID, 'project-image', true); ?>" style="width:50px; height:50px;" /></div><b><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></b><br /><?php the_excerpt(); ?>
</div>
<div class="long-sep"></div>
<br clear="all" />
<?php endforeach;
wp_reset_postdata();?>
</div>
</div>
<?php get_footer(); ?>
]]>With the plugin disabled, everything works as it should. Any thoughts?
I’m using WordPress 3.6.1 and Buddypress Docs 1.5.1. My theme is a simple child theme of Twenty Twelve.
https://www.ads-software.com/plugins/buddypress-docs/
]]>