Questions tagged [template-tags]

Template tags are custom WordPress-specific functions for use in theme template files.

27 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
1 answer
113 views

Strange Behaviour with is_home()

I'm having an odd issue, although I can understand why it works like this I do need to find a way around it. I have used the the request filter to modify the query for the home/index page to select ...
Stewarty's user avatar
  • 312
1 vote
1 answer
49 views

WordPress menu link doesn't work properly

I am developing custom site. The header links work on home-page but when I go inside shop then the home-link becomes siteurl/shop how to solve this? <div id="content" class="site-content"> &...
xreonn's user avatar
  • 11
1 vote
1 answer
17 views

Please help me to figure out how to display my tags

desperately looking for help. Have a Wordpress theme which does not display post tags on a single page and I badly need to have them there. Developers only named a file which needs to be modified. It'...
Vytautas Ravinskas's user avatar
1 vote
3 answers
98 views

different tag different stylesheet

i have tags, and for some tags i want to load a different stylesheet But i don't know how i have.... function customstyles() { if ( is_tag( 'circulair' ) ) { //Register and enqueue the ...
bets's user avatar
  • 11
1 vote
1 answer
196 views

Changing Image Size In The Content tag

I am developing a WordPress theme locally and I can't figure out how to get an image to display in a normal size in the_content(). At the moment, the images are displaying the same size as my featured ...
Clinton1000's user avatar
1 vote
0 answers
90 views

Checking if a specific date archive is being displayed

The is_month(), is_year() or is_week functions don't accept arguments. Are there any other functions available that I'm able to use to determine if I'm viewing specific month/year/week archive ? Or do ...
onetrickpony's user avatar
  • 13.6k
0 votes
0 answers
24 views

Wordpress blog post tags in 2 rows

In the WordPress theme I use, I can usually add 5-6 tags in one blog post. If I add more tags (7, 8, etc...), the tags continue to go under the sidebar, and don't make a second row (what usually the ...
DeeJay's user avatar
  • 1
0 votes
1 answer
31 views

How do I get tags linking to proper pages (/tag/sample-tag -> pages with that tag)

(Warning: WordPress newbie ahead...) I have a WP site with a bunch of posts, many of which have tags associated with them. However, clicks on links to such tags -- https://example.com/tag/sample-tag) ...
Jim Miller's user avatar
0 votes
0 answers
153 views

Child theme overirde template-tags in a theme built on underscores in inc/template-tags

I've read this post and I don't think this question is a duplicate because I have a specific question that has not been answered. My parent theme is using the following to require a template tag php ...
Anders Kitson's user avatar
0 votes
1 answer
17 views

small problem in the article ()

WP 5.4 Theme masonic I try to show the numer of comments in each article it'as ok (see the picture) but on the next line, itshow () I don't know why !?!? the code in the file template-tags is: ...
pascalniv's user avatar
0 votes
3 answers
410 views

Get_header raises an 500 internal server error

I am working on custom development in wordpress, my problem is the following every time I create a new template. Code /* Template Name: Citas Rolex*/ get_header(); echo "<h1>loren ipsum</...
Luis Bernal's user avatar
0 votes
0 answers
41 views

Tag pages with regular editor

So, I am creating a website, review products and attach dozens of tags to them dependent on what the product entails. I have a custom review template for my products and based on what I tag the ...
MAXEV's user avatar
  • 1
0 votes
0 answers
78 views

Pagination doesn't work in query post in tag template

In tag template I use the following query post: global $query_string; // required $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; ...
Giulio's user avatar
  • 51
0 votes
1 answer
260 views

using themename_the_custom_logo() in template-tags?

I am trying to learn how to create a theme for wordpress so i looked at the default theme 'twenty sixteen'. I was crawling around it and searching everything that i find strange then i saw this code ...
Khesht's user avatar
  • 1
0 votes
1 answer
170 views

Limit Tag Links in Post Content

I am trying to Limit Maximum Numbers of Tag Links to appear within post content. Below is my code. I don't know how to fix it up. function link_words( $text ) { $replace_times=3; $replace = ...
Godwin Alex Ogbonda's user avatar
0 votes
1 answer
42 views

Show author image at home page latestest posts plugin

On my home page, I'm showing the last 3 blog posts with their respective titles, texts and their featured images. I need to change the featured image at homepage to each blog to the image of the ...
marcdecline's user avatar
0 votes
0 answers
533 views

method to fetch entire tag list on archive.php

What I have Tried → <?php $taginto = get_the_tag_list(); if ( ! empty( $taginto ) ) { echo '<a class="categum" href="' . esc_url( get_tag_link( $taginto[0]->term_id ) ) . '">' ...
WordCent's user avatar
  • 1,867
0 votes
0 answers
35 views

Template tags not working in the customizer preview

I have a small code to inject some CSS to the single post. And it has an option in the Customizer to enable/disable the CSS. My code is similar to this: add_action( 'wp_head', function() { if ( ! ...
Anh Tran's user avatar
  • 4,122
0 votes
0 answers
1k views

Hide Certain Tags on Single Post Page

I'm trying to hide certain tags from single posts pages. I've googled and found 2 codes but both are hiding the whole post page. I'm using a theme that needs using 2 tags ticker and slider to show ...
Zaher's user avatar
  • 19
0 votes
0 answers
164 views

edit_post_link returns blank

I'm using edit_post_link in The Loop and the function keeps returning the $before and $after arguments with blank content. <?php edit_post_link('edit', '<p>', '</p>'); ?> returns &...
b3asts's user avatar
  • 11
0 votes
0 answers
488 views

'Post_tag' taxonomy tags don't link to existing posts in CMS

I'm using this bit of code to retrieve the object data for post_tag taxonomy. <?php $tax = 'post_tag'; $tax_terms = get_terms($tax); if ($tax_terms) { foreach ($tax_terms as $...
sledgeweight's user avatar
0 votes
0 answers
141 views

Get list of body classes for X page?

Is there a way to grab the list of body classes for X page? I tried: <?php get_body_class('home'); ?> but got a console error for function not defined.
Desi's user avatar
  • 1,209
0 votes
0 answers
82 views

Own Custom Tags/Category page ( posts)

I want to make a page where on each tags : My page should look alike : http://www.missmalini.com/aamir-khan-2/ Above page is coming from http://www.missmalini.com/celebrity-fan-pages/ this are ...
user3209031's user avatar
0 votes
0 answers
60 views

Tags results not displaying for post types

UPDATE Here is the thing... I have a structure where I created a post type which has taxonomies and also tags. Let's call it Works. However, when I need to filter by tags, using the tag template, ...
andresmijares's user avatar
0 votes
1 answer
450 views

WP Query conflict on tag.php and category.php template

My WP_query in the header menu fails to pull any posts on tag and category pages only. Error occurs even with the Loop removed from those template pages. The menu in the header lists the parents. ...
user33445's user avatar
0 votes
1 answer
56 views

Tags Sorted By Characters?

If i put multiple tags in a post then after publishing the post all tags are auto arranged by Character Serial, like A B C D... any idea if i wish to have all tags will not sorted or arranged by ...
Hasan's user avatar
  • 169
0 votes
1 answer
82 views

Targeting all pages except top level pages

I have used '0' == $post->post_parent successfully in my templates to target top level pages. However, I cannot seem to target all pages EXCEPT top level pages: <?php if ( '0' !== $...
Caroline Elisa's user avatar