The single post template. Used when a single post is queried.

learn more… | top users | synonyms

4
votes
3answers
1k views

Posts in multiple Categories different single.php

I am smashing my head against some code. Here is the situation: I have one post in 3 different categories, this post has to be visible in "category 1" with the single1.php, in "category 2" with ...
3
votes
2answers
3k views

How to detect single.php (but not single-portfolio.php)?

When I'm using is_single(); in my <head> section to add some style to website navigation it executes correctly on blog posts but it also executes on single "portfolio" post type posts (so ...
3
votes
1answer
1k views

single page wordpress

I like wordpress as a CMS and I think it's got a lot there with it's vast plugin library however the front end, dare I say it is a bit out of date. I don't like the system of old going page-to-page ...
2
votes
1answer
1k views

Pagination for custom query on single.php

I'm building a site and the basic structure on most pages is as follows: <!-- content query --> <!-- recent posts preview query (paginated) --> <!-- related posts preview query ...
2
votes
3answers
4k views

get taxonomy name of current post

Hierarchical taxonomy of custom post type 'projects' > 'projects_category'. Two example 'projects_category' hierarchies would be: Big Corporates > 1st Company Name > A Post Title Small ...
2
votes
3answers
4k views

How to check if the product is in a certain category on a single-product.php in Woocommerce?

How in the world can I check if a product is in a certain product category on the single-product.php? <?php if (is_product_category('audio')) { echo 'In audio'; ...
2
votes
2answers
329 views

Make custom post type display as a page

I am trying to make my custom post type display on the front end as if it were a page. Depending on the theme, it won't have the date, author, etc... I've looked into creating a template such as ...
2
votes
2answers
841 views

How to display different single post template based on author?

My current singlepost.php makes use of the following if conditions and renders the appropriate template. <?php $post = $wp_query->post; if ( in_category('4') || in_category('59') ) { ...
2
votes
2answers
532 views

Best way to programatically add “rel” attributes to page and post images

For single posts and pages, I would like to add certain rel attributes to all the images on the contained therein added with the "Add Image" functionality on the edit screen. The attribute would be ...
2
votes
2answers
1k views

Related Posts by Multiple Tags?

I was curious if was possible to display related posts by multiple tags. The site I am working on has about 5 tags per post. Most posts have 1 or 2 tags in common. The related posts I'd like to show ...
2
votes
1answer
1k views

HTML code in Custom field

I'm using a custom field to display images in a slider on each post, but when I update the post after having entered the HTML code in the custom field, the code disappears. I'm assuming that there is ...
2
votes
2answers
2k views

Custom permalink structure only for default posts

Does anybody know how to modify the url struct only for the single post page? When I go to a post page, the url should look like: example.com/xxx/my-post. All other urls (with the exception of the ...
2
votes
2answers
279 views

single page site with subpages

i want to make a single page site which has subpages with following structure about us team -member1 -member2 contact and i want the output to be like <div class="about-us"> team content ...
2
votes
3answers
1k views

How do I create a widget that only allows a single instance?

How do I create a widget that only allows a single instance of a widget to be added through the Wordpress interface? The default behaviour of widgets allows multiple instances to be added. I am ...
1
vote
3answers
762 views

Is it possible to use a single custom post as the site front page

I know I can set a static page as the homepage but is it possible to set a single custom post as the site front page? I created a custom post type called "portfolio" where users can add all the work ...
1
vote
1answer
3k views

Conditional for single-{post-type}.php

Please help with this code for custom post type "video": If is single-video.php page { list custom-taxonomy of video. Example actors } Else { do nothing } I´m tried with is_single, ...
1
vote
2answers
239 views

How do I show google ads between post content?

I want to show ads by Google between text content, like show 3 ads one after 1st para second after 3rd para and one at end of last para. I know i have to modify in single.php but being novice in php ...
1
vote
3answers
875 views

How to disable the single view for a custom post type?

I created a custom post type: register_post_type('sample_post_type',array( 'labels' => array( 'name' => _x('Sample Posts', 'post type general name'), 'singular_name' => ...
1
vote
2answers
1k views

Display Taxonomy Image on single.php

I'm using Taxonomy Images, and I can't figure out how to display a category's associated image on a single.php. Essentailly, when a user is viewing a post that utilizes the single.php template, it ...
1
vote
2answers
807 views

In need of array of post tags

On the single-post page within the loop I need an array of the_tags() which is a string. and get_tags() gives me all of the tags not only this posts. Is there an easy way to get this?
1
vote
2answers
70 views

Why use while over if in single wordpress posts?

Why is while() used instead of say if() here: <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'single' ); ?> <?php ...
1
vote
1answer
132 views

Add code just after Post content

I am in a bit of dilemma here so bare with me. I want to add something like this code just after the content in a post: <p>Please let me know what you think by <a href="#comment">leaving ...
1
vote
1answer
569 views

in_category() works in single.php but not in page.php?

I'm using in_category(array) inside The Loop to detect whether a post is categorised into the Discussion category (or has one of a couple of slugs). This works beautifully on single.php but doesn't ...
1
vote
1answer
660 views

how to know if the post has pagination (<!--nextpage-->) or not

i need a solid solution for checking if a post has pagination or not, regardless of the number of current page in the pagination, and even if the post is in the first page of the pagination. the check ...
1
vote
2answers
427 views

Custom Post Templates

The Issue: I am looking for custom single post templates, to add or remove individual elements as a function of a normal single post. There are a lot of ways to create custom post templates for ...
1
vote
2answers
186 views

Restrict post navigation to current sub menu

This is what I'm using to output my post navigation: <?php if (is_single() ) { ?> <nav class="post-navigation"> <h1 class="visuallyhidden">Post Navigation</h1> ...
1
vote
2answers
1k views

Pagination on single post page?

I've found many pagination tutorials/plugins that work on pages displaying a list of posts such as index.php E.g. - ...
1
vote
1answer
640 views

posts_nav_link on single.php

The situation...I use 3 categories. One of them is called 'News'. This page shows on the left the latest post in the category 'News' and on the left it shows the 10 most recent posts from this same ...
1
vote
1answer
1k views

Can't get the_content of the parent page from its single post?

This is a page that list posts witht he category Content (CDs): <div id="tagline"> <div class="container"> <?php // Run main loop (The Loop). ?> <?php if ( ...
1
vote
1answer
46 views

I want to extend the current themes' single.php to display the meta fields of my CPT

I am developing a plugin, which registers a role, a CPT and some metaboxes. I am now at the point where I included as well a single-mycpt.php into my plugin. Here's my current issue: I can't simply ...
1
vote
1answer
642 views

Using loop pagination on single.php

I want the main front-page loop to show in a section on both index.php AND single.php templates, with pagination. Pagination works fine on the homepage, but not on single posts. This is the code ...
1
vote
1answer
209 views

changing permalink for custom template in posts of a certain category

I've created a unique single post template to give people the option of reading all posts of a certain category using the awesome "reveal.js" which they access via this link <a ...
1
vote
1answer
775 views

Using wp_list_categories like the the_category (showing just current categories of a post)

fromi'm using wp_list_categories to get an unordered list with headlines (on single.php inside the post-loop): <ul><?php wp_list_categories('title_li=0');?></ul> the thing is: i ...
1
vote
3answers
793 views

Custom post type not displaying content from single-{custom post type} page

I am trying to create a custom post type with taxonomy and a shortcode for my custom search in a plugin.When I activate my plugin I see my CPT and taxonomy on dashboard. But when I publish the post I ...
1
vote
1answer
227 views

How can I make a post that belongs to a category or have specific tags, display different from the other single posts?

How can I make a single post display different from the other single posts when I add it to a specific category. example: I have a post that is in 3 categories: music, songs & video clips. I ...
1
vote
1answer
256 views

Display all posts that were published before full post on single.php

The way I would like my blog to work is a user clicks on a post that was published on 12th March 2012 (for example) they get taken to single.php where the content of that post is displayed as normal. ...
1
vote
1answer
170 views

custom post type parsed as attachment

I have few custom post type, on the single post of which i am getting 404 error page. I think i've tried almost every solutions posted on web but still it is not working for me and i've started to ...
1
vote
1answer
239 views

Display a post map on a blank/new page

On my single.php file I am displaying the_title(), the_content() and a link to a Google Map (Javascript v3). Lat/Lng coordinates for each location map are held in two separate meta fields attached to ...
1
vote
2answers
3k views

How to show link to next posts in single.php

I can't get get_next_posts_link to work. shouldn't his code work? <?php echo get_next_posts_link(); ?> Well, I am trying to get next 5 posts, any idea how? EDIT: Accroding to: <?php ...
1
vote
3answers
2k views

How to convert multi-site to single site

I need to take a site that is installed as a subdomain blog on a multi site install and move it to it's own domain on a standalone wordpress installation. How can this be done? I am running into ...
1
vote
2answers
320 views

How to add shortcode tags in single.php

In my theme has one shortcode tags to display tags of post and function to load content post. But in function doesn't include shortcode tag. Now I want to add it to function but i don't know how to do ...
1
vote
1answer
113 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...
1
vote
1answer
346 views

Enable infinite scroll on single.php

I have a problem similar to the author of this thread: Possible to paginate on single.php? I am trying to enable infinite scrolling on single.php. So far I successfully load an additional 1 post when ...
1
vote
0answers
34 views

On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)

Looking for a way to on single.php fetch and show the actual post, and then by looking on the menu_order value of that specific post (lets say the post have menu_order value 3 in this case) go and ...
1
vote
1answer
953 views

Displaying Meta Box Image

I have some problems displaying info from my custom meta box in my custom post type single. I'm using Reusable Custom Wordpress Meta Boxes by Tammy Hart. I'm able to display the textfields using ...
1
vote
0answers
82 views

How to make the link to the category for a post go to corresponding page number in archive?

For instance, I am at http://url.com/single-post and in the post there is a link to the category that navigates to http://url.com/category/page/3/ which is the corresponding archive page that contains ...
1
vote
1answer
376 views

How do I display a custom field from a custom taxonomy in single.php?

I know that the following mysql query produces the exact results I wish to echo within single.php: SELECT meta_value FROM `wp_taxonomymeta` WHERE `taxonomy_id` =565 AND `meta_key` LIKE 'baseurl' ...
1
vote
1answer
703 views

Single post comment template not working

I cant get the comments template to show up in my single-events.php This is my code <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'events' ); ?> ...
1
vote
0answers
106 views

Adding range to wp_link_pages();

I have some very long posts, some have more than 50 pages() and when using wp_link_pages it give me 50 internal post links, clearly this isn't usable. How can I add a range to the wp_link_pages ...
1
vote
0answers
98 views

Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages

So I took loop-single-forum.php, copied it and renamed it, fixed it so the site is calling the copy and then removed what I did not need from it to place it in a sidebar widget. It works beautifully ...