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

learn more… | top users | synonyms

1
vote
1answer
37 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
16 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 ...
0
votes
0answers
16 views

Template tag for custom field sub heading in post - error

Im trying to create a template tag for a subheading for a post which is entered as a custom field. This is the function I have: function spost_subheading() { $key = get_post_meta($post->ID, ...
-2
votes
1answer
80 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 ...
0
votes
2answers
82 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
27 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
108 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 ...
0
votes
3answers
405 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 ...
0
votes
0answers
49 views

change layout via post tag & hide certain tags?

Is it possible? I'm using _S framework and I'm intending 2 different layouts for the index page appearance of my post's - one with a large image appearing first, under which I want the post-header and ...
1
vote
2answers
82 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
132 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
75 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
63 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
376 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
853 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 ...
0
votes
2answers
660 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
111 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. ...
0
votes
2answers
321 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
31 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
101 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 ...
1
vote
0answers
39 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 ...
1
vote
2answers
131 views

How can I link a CSS file only on single posts?

If I understand is_single() correctly, it's only supposed to return true when the current "post" (in a generic sense) is a literal post (i.e., it has a post_type of post), and that it will return ...
0
votes
1answer
40 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' !== ...
1
vote
1answer
527 views

Check if password protected post is visible

Is there anyway of checking if a password protected post is visible / not visible? I want some thing that says this; If the post is password protected (that parts fine) and the correct password ...
0
votes
2answers
1k views

Displaying list of subcategories and not parent category

I have a blog which has three top level categories. Each top level category has a list of sub categories. I am displaying only certain top level category posts in certain sections of the website. ...
3
votes
1answer
58 views

When to use which plugin output method?

I'm a Drupal dev, getting into Wordpress. So far as I can tell there are a few different methods by which a plugin can output content on to a Wordpress site: Shortcode Rewrite API Widget API ...
6
votes
1answer
943 views

How do I display a tag cloud under my post that only shows tags from that post?

I've be looking to add a tag cloud under my post that only shows tags pertaining to the post. The tags shown should be in a tag cloud format; the post tags that have more post tagged with it will be ...
0
votes
1answer
246 views

What is the p parameter in a get_posts() parameter array?

I've seen code that looks like this: get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment')); What is the definition of the p parameter and is it documented anywhere? I can't find ...
2
votes
1answer
80 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 ...
1
vote
2answers
1k views

Displaying page content in category archive (archive.php)

I'm new to template editing in wordpress and I'm trying to get a page description to show up on my site but it is not appearing. The URL I'm trying to get to display the description is here: ...
0
votes
1answer
870 views

page.php – is_front_page NOT WORKING

I'm trying to target my landing page with is_front_page or is_home in my page.php file but it's not working. I have set the settings > reading to a static page. However, if I create a page-home.php ...
0
votes
2answers
463 views

Conditional template tag for buddypress pages

I'm trying to assign a special template only to buddypress pages (activity, members, profile...). All other posts / pages use a different template. Problem is: I just can't find a good way to tell if ...
1
vote
2answers
551 views

tag.php pagination and query_posts()

Having some issues on the tag.php page. Right now it just give me a "nothing to show" If I have no query it shows posts, but I want to change the number of posts per page. Changing the reading ...
3
votes
4answers
449 views

How to show the real post date in a draft

When looking at a draft post, get_the_date() only seems to return today's date, not the post date, even if I have selected another date on the post edit screen. Is there a way to show the "actual" ...
0
votes
3answers
505 views

How to support letting users add their OWN logo to a custom theme?

I am a rookie theme developer (3 months in) and I am trying to figure out how to implement the following functionality: The theme I am building has a logo which I would like for users to be able to ...
3
votes
2answers
554 views

How to get the clean permalink in a draft?

When I use the_permalink or get_the_permalink in a draft or scheduled post, the URL provided is not the "final" permalink—it is the unpretty ?p=xxxxx version. How can I get the final, "clean" ...
0
votes
2answers
106 views

Listing parent section in search results

I'm building a search results template and want to display the parent section of the website for each result returned. so at the bottom of each search result excerpt it'd say "Found in [section] | ...
0
votes
1answer
105 views

is_front_page use in sidebar.php

I want to introduce some code into sidebar.php dependant on whether the site was on the front page or not. ( I have a static front page and am using the front-page.php file ). To cut a long story ...
3
votes
1answer
2k views

Echo author ID in author.php

This is probably a super simple question. But how do I echo the ID of a user on author.php? I've tried the_author_meta('ID') But it didn't seem to want to work. I want to echo it at the end of a ...
1
vote
1answer
271 views

How do I reset this wp_list_categories query?

How do I reset a query that generates a list of categories with wp_list_categories? The query below builds a two column list of categories that is then displayed with the second code chunk. I'm ...
0
votes
1answer
563 views

Show the current post's category, without displaying parent category

I have a series of posts that all reside within a 'Main' parent category. Various posts are assigned to sub-categories. What I need to do is display the direct parent category for the currently ...
0
votes
1answer
616 views

Why does this search.php not work?

This search.php shows all the results from a said search however, doesn't include the title, The Search Results For...... and search query amount; or even the no searches found and prints the ...
2
votes
2answers
1k views

Manually set global $post vars with an ID, in order to use template tags

I have a function retrieving ID's of posts by very specific means. I need to be able to set the global $post in order to use functions like the_content(), which does not allow an ID as a parameter. ...
4
votes
1answer
3k views

why doesn't the_content() work in this {single-custom_post_type.php} page?

This code is from my page single-publication.php. It outputs the relevant custom fields etc (here wrapped in template tags), but the_content() won't output the post content. I've resorted to using ...
0
votes
1answer
46 views

odd behaviours from template tags

Some of my template tags are playing up, and they have left me confused. On one site, that has been live for over a year without any of these issues, on all the pages that have custom query loops, ...
0
votes
1answer
607 views

how to limit and display tag?

Hi i need to show random 3 tags for a post. all my posts have been tagged with more than 10 tags, i need to display any 3 tags randomly. for eg: A sample post <a href="/tag1">Tag1</a> ...
0
votes
2answers
468 views

<!--more--> help

I have a custom post type called "Blog", in my templates I looping over the blog type and doing the following, <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ...
0
votes
2answers
1k views

How to change a custom query into a standard loop?

I'm trying to modify how results are displayed in a post list that's currently controlled by the code below. However, it's not built in the WP_Query while ( $the_query->have_posts() ) : ...
0
votes
1answer
450 views

Second Level Menu

I'm trying to figure out how to do, Second Level Menu as a template function, that persistent when visiting any level, whether its a top level page, or a grand children Page. Any Ideas?
0
votes
2answers
272 views

How can I detemine the parameters needed by the_widget()?

I'm working with an old (now unmaintained) widget, which only allows one instance. Since I want to have a different sidebar on the homepage and I want this widget on both sidebars, I figure I need to ...