Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
15 views

Which functions.php to modify to get rid of nofollow. noindex

so first off, I am NOT an I.T. guy or a developer but a sales guy who happens to know how to get around with code a bit. Backstory: our web developer added meta robots nofollow, noindex without ...
0
votes
0answers
9 views

How to make tags display the tags associated with that specific post instead of the entire tag cloud?

How to make tags display the tags associated with that specific post instead of the entire tag cloud? For example on the link below it's showing every tag on the site I want it to display on those ...
0
votes
0answers
27 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; ...
0
votes
1answer
15 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 ...
0
votes
1answer
37 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 = ...
0
votes
1answer
14 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 ...
0
votes
0answers
34 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 ) ) . '">' ...
1
vote
2answers
624 views

Disable Woocommerce product tags display by alphabetical order

I have a Woocommerce e-shop where each product has at least five tags. The problem is each product's tags are displayed alphabetically on the single product page. I would like to know if it's ...
1
vote
1answer
19 views

Sort list of page templates a-z?

In the code below, it possible to sort the results alphabetically - and if so what changes do I need? <?php $templates = get_page_templates(); foreach ( $templates as $template_name => $...
4
votes
1answer
1k views

get_parent_theme_file_path vs. get_template_directory

I've been reading about the new functions for referencing theme location added in v4.7. I read through the trac ticket. I understand why they created these functions and the benefit of ...
0
votes
0answers
22 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 ( ! ...
0
votes
2answers
105 views

php within html within php

I use an extension called Custom Field Suite to import info from a csv in order to batch create posts. In order to display the form fields I use <?php echo CFS()->get('image_location'); ?> ...
1
vote
3answers
86 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 ...
0
votes
2answers
33 views

Template Tag Does Not Work in Page Template

I've created a page template and used this code to call a post which contains a shortcode: $post_id = 129; if( get_post_status( $post_id ) == 'publish' ) { the_content(); } The problem is that ...
0
votes
1answer
80 views

How do I str_replace with template tag?

I have a template tag of: <?php echo the_post_thumbnail( 'full' ); ?> It outputs: <img src="/graphics/magazine/802/1.jpg" class=" wp-post-image" alt="" /> I want to remove 'class=" wp-...
-1
votes
1answer
41 views

Misleading information in the Codex, how do they get away with it? [closed]

I'm new to WordPress Development but I've programmed in PHP for a couple of years. My understanding is that the Codex pages are as close to authoritative information on WordPress that you're going to ...
1
vote
1answer
269 views

setup_postdata is not returning any values

I am using ACF to create a custom field called facilities. Within that field is a repeater field called facility. So each store has 'facilities', which contains a number of 'facility'. What I am ...
1
vote
1answer
73 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 ...
0
votes
1answer
37 views

showing tag beside catagory

thanks for your guidance, here is one last but not least thing for me to learn, i am using Today news wordpress theme, since with your help i have moved my process from category to tag based ...
0
votes
1answer
92 views

Wordpress tag or archive php file customization

I am not that pro with php but i have good concept and can find my way in cleverly, this forum have always put me ahead of the game due to people like you who share as the care, I have a site that ...
0
votes
0answers
551 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 ...
0
votes
1answer
151 views

How do I get shortcode, widget and template tag CSS to load in the head only as required? [duplicate]

I have a shortcode, widget and template tag that need to load CSS. I am registering in init, and enqueueing as required. The only problem is, it is adding the CSS loader at the bottom of the page, ...
0
votes
1answer
1k views

Calling the first & last post by category in custom post type

I have custom post type for comics, called “comic” and have written a basic comic navigation. First —previous — (current) title — next — and last comic. In functions.php, this code calls for the ...
0
votes
0answers
98 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 &...
0
votes
0answers
205 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 $...
0
votes
0answers
112 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.
0
votes
1answer
1k views

Getting custom post type author and date published

In underscores I can get my custom post type just fine with pre get posts along regular blog posts. However the date published and author does not display. How can I modify my template tag (...
1
vote
1answer
232 views

Is there a way to display a menu using the ol tag instead of the default ul tag?

I'm trying to display a menu using wp_nav_menu(). The default markup that the function generates is a menu parented by a <ul> tag like so: <ul> <li><a>Menu 1</a></...
0
votes
1answer
51 views

Custom Fields Question

I'm new to wordpress and I am trying to understand these custom fields. I read the wordpress codex page refering to custom fields but I have some questions. I take for example my site. I created a ...
0
votes
1answer
1k views

the_category() tag not styling HTML or CSS

I am having problems getting my the_category() template tag to style accordingly with the rest of my theme. I believe this is because the HTML isn't output the same way as the the_author() and ...
0
votes
2answers
64 views

comments_number fails to print

I want to display the number of comments on a post using the template tag <?php comments_number( $zero, $one, $more ); ?> However, for some reason this tag does nothing and it is ...
0
votes
1answer
56 views

How to modify template tags function?

By default, get_user_meta returns an array, a single value or false. I want to change the return value somehow. How to do that? I want to modify the return type of a template tag get_user_meta inside ...
2
votes
1answer
5k views

Wordpress function/template tag to get first n words of the content

OK, this might be a duplicate, I was just unable to put my idea in proper search terms, sorry for that! Is there a built-in function or template tag to get the first n words of the content? I mean ...
0
votes
0answers
79 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 ...
-2
votes
1answer
2k views

Adding more information to a Content Product Category

The template content_product_cat is responsible for showing the product categories images and its name. I want to display more information below the name of a category e.g a Category called 'Books', I ...
1
vote
2answers
810 views

Template tags vs get_template_part() vs functions.php

When to use template tags and when to use get_template_part() and when to use function.php? I am confused at them. For example, if I want to show related portfolios under single portfolio, I can ...
0
votes
0answers
50 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, ...
0
votes
4answers
922 views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
1
vote
4answers
11k views

Multisite get_home_url(); - Getting URL for current site

What would be the replacement for get_home_url() when using a multisite? For example, if I have one theme installed across several sites, and within the theme there are links that need to be specific ...
1
vote
3answers
565 views

How to check if I am inside the WP Theme Customizer preview?

I have some elements showing on the home page that I do not want to display in the Theme Customizer preview window. Is there a simple check in PHP that I can use for that ? For example: <img ...
0
votes
1answer
292 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. ...
-1
votes
2answers
176 views

Why don't some template tags work when querying information on single.php?

I'm trying to fetch content about the current post into the header.php of my theme (to dynamically insert Facebook OpenGraph Metadata). Since I'm on a single post page, shouldn't it be able to run ...
0
votes
1answer
243 views

navigation link based on custom field

I'm looking for a method to order posts by a custom field so that the navigational links on a single post template would point to the next or previous post in the sequence defined by a number in a ...
1
vote
1answer
2k views

Multiple templates for single custom post type

Does anybody know of a way to modify the wordpress template process so that a single custom post type can be displayed on two separate templates based on the value of a custom field. For example I ...
0
votes
1answer
2k views

Setting selected term_id with wp_dropdown_categories?

I'm using this code to get the term_id of a custom taxonomy. The drop down does list the terms of the taxonomy Type. When I print the $terms variable I see the term ID of the post i'm editing on the ...
1
vote
2answers
3k views

Getting tagid from tagname

Currently I am working on a rating plugin. You can see the code I got so far below: <?php if (function_exists('get_highest_rated')): ?> <ul> <?php get_highest_rated_tag(12, 'both', 0, ...
0
votes
2answers
1k views

Organize template parts and page templates in folders in regards of template hierarchy

Hello and happy new year Suppose one has a large theme composed of several post types, page templates and a bunch of custom loops and template parts which is best keeping in separate php files. What'...
0
votes
2answers
2k views

add short code not working

I am new to wordpress, I am creating a plugin and for the short code, I am using the short code api. But when I insert this shortcode in my page, it displayes as it is, it does not display the ...
0
votes
1answer
47 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 ...
0
votes
1answer
358 views

How can I include custom category and tag base in template files?

How can I include custom category and tag base names in the category and tag template files? Specifically, I'd like to include in the page title of category and tag pages the custom category and tag ...