Template tags are custom WordPress-specific functions for use in theme template files.
6
votes
1answer
371 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 ...
3
votes
1answer
2k 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 ...
3
votes
2answers
277 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" ...
3
votes
2answers
1k views
Remove line breaks in wp_list_categories()?
I am trying to output a list of categories per an article. I am using the following code,
<?php wp_list_categories('child_of=270&style=none'); ?>
(string) Style to display the categories ...
3
votes
1answer
44 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
...
2
votes
2answers
445 views
Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
I really need some help, I dont know where else to turn with this request. I'd like to add a shortcode to one of my posts. The template tags get_next_post() and get_previous will not work for me since ...
2
votes
1answer
67 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
5answers
2k views
On the category page, get the category object
Right, hopefully a nice and simple one... I'm on a category page with the id of 4, I want to get the category object back so I can interogate a few values.
I've had a good old look in the WP codex ...
1
vote
2answers
88 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 ...
1
vote
2answers
235 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" ...
1
vote
2answers
600 views
Minor css-change based on topmenu - how?
I want to make minor css-changes based on the choice of the top (root) menu.
What's the proper way to handle this in WP?
//edit//
It's a website (pages), no blog, and basically, the colors of some ...
1
vote
1answer
202 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 ...
1
vote
1answer
167 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 ...
1
vote
2answers
636 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.
...
1
vote
2answers
694 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:
...
1
vote
2answers
407 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 ...
1
vote
1answer
486 views
Exclude a category from the_category in the single post page
I want to include something like the the_category function in a WordPress post, which by default echoes a list of links to all categories the post is attached separated by comma, but I want to exclude ...
1
vote
0answers
21 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 ...
0
votes
3answers
227 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 ...
0
votes
2answers
308 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
280 views
Is it possible to add a child post into the parent page?
Is it possible to add a child post into the parent page?
Basically I have a 1 parent page and it has 2 child page that has a simple content , and I want the child page content to put also in the ...
0
votes
2answers
224 views
Return function only on certain pages
I'd like this function to only return on certain pages. How might i do that?
// Retreats Accordion
function retreats_accordion() {
?>
<!-- accordion root -->
<div id="accordion">
...
0
votes
1answer
29 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 ...
0
votes
1answer
124 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 ...
0
votes
2answers
751 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
3k views
Get permalink and title by post name?
In the theme there is a custom post type called faq
I just want to get certain post by its name (NOT by id cause no id exist).
<?php query_posts('post_type=faq') ?>
how to get the_tile() and ...
0
votes
1answer
824 views
How to query details of images in gallery that is attached to a post
I have several images attached to each post. I need to generate a gallery, but because it's heavily customized I don't want to use a gallery plugin, nor the gallery short code. It's also situated in a ...
0
votes
1answer
276 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
144 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
1answer
469 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
271 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 ...
0
votes
1answer
79 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 ...
0
votes
1answer
914 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 ...
0
votes
1answer
349 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
457 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 ...
0
votes
1answer
43 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
407 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
1answer
376 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
235 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 ...
0
votes
1answer
78 views
how to add # before tags?
Like Lifehacker and several other sites, would like to know how to add # before tags displayed on the site.
for e.g. instead of a tag like "abc", how about "#abc". - is there a way to automatically ...
0
votes
1answer
30 views
Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?
For example, if the post was published on may 5th 2011, then clicking on "May 5th, 2011" would show all posts published in May 2011. How can that be done?
0
votes
2answers
104 views
How to tell if all posts are only in one category?
I have a category.php page which redirects users to a certain template page if the article in the output is in a category. However, I am seeing that if I have say 10 articles,and only one is in the ...
0
votes
0answers
32 views
Jquery Mobile & Template Tags [closed]
I'm having trouble integrating jquery mobile on my site, when it comes to pages I don't have any problem but for some odd reason when it comes to the template tag I'm having trouble, all data ...
0
votes
1answer
69 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
74 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
1answer
28 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
59 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 ...
0
votes
1answer
29 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' !== ...
0
votes
2answers
685 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.
...
0
votes
2answers
74 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] | ...
