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

learn more… | top users | synonyms

4
votes
2answers
98 views

How do I create a link that will always show the latest post?

If I want to create a link that will always show the latest post how can i do that? Lets say I have three post types and there are three links with posts names (like a nav list) to those post types. ...
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
4k 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, ...
2
votes
3answers
5k 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
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
2answers
344 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
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
2answers
890 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
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
539 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
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
1answer
500 views

Enable infinite scroll on single.php [closed]

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 ...
2
votes
2answers
331 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
837 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
2answers
116 views

Template for specific post of custom post type

I have the CPT "event". I have created single-event.php. I want one particular event to use a different template than single-event. I read elsewhere that this could be done by creating a ...
1
vote
3answers
2k 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
38 views

“next_posts_link” and “previous_posts_link” display me NOTHING

I'm trying to add links "Previous Post" and "Next Post" in my single.php file without success because previous_posts_link and next_posts_link dont return anything. Honestly I do not know where in the ...
1
vote
2answers
306 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
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
865 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
76 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
557 views

Insert After Second Paragraph Without <P> Tag?

I use a code like the one shown below to insert ads after the first paragraph. The problem is that this code requires the content to be displayed within paragraph tags and I would like to use this ...
1
vote
2answers
722 views

Using previous_post_link and next_post_link to wrap around post sequence

For a single custom post type, I'm using previous_post_link and next_post_link with simple arrows. (Although text arrows are shown here, in the actual I'm using graphics with the text hidden via CSS.) ...
1
vote
1answer
140 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
583 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
757 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
458 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
212 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
677 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
52 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
751 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
241 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
908 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
849 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
232 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
267 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
181 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
248 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
608 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
122 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
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
1k 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 ...