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

learn more… | top users | synonyms

0
votes
4answers
2k views

Create single.php for specific category by category id

I'm trying to create template for specific category with id 1 for example. The template should be applied to all of the pages belongs to this category. So, it should be something like single-1.php. I ...
0
votes
1answer
16 views

Get the category of post

I am on the single.php file and I am trying to get the category of a blog post which is either Blog or News. The reason I want to do this is that the website I am building has both a Blog and a News ...
1
vote
2answers
2k 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 this:...
0
votes
1answer
16 views

Only show related posts when another post has same term

Trying to build an easy "related posts" call, I would like to have it only shown, when another post has the exact same term and shows up. It works at the moment so far, but also shows up, when the ...
0
votes
1answer
740 views

Only nextpagelink on wp_link_pages

Does someone have a solution to display only the nextpagelink with wp_link_pages in single posts? I've tried different solutions, but none of it worked. As I reach the last page - wp_link_pages ...
18
votes
5answers
11k 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' => ...
0
votes
0answers
14 views

Single Post as Home with Next/Previous Going to Permalinks

I'm building a webcomic website and I want the home page to always display the latest single post, i.e. comic. I want buttons for “First” “Previous” “Next” and “Latest” that will take the user to ...
0
votes
2answers
423 views

404 Page Not Found for Only One Post

I have 40+ posts on my blog. Only one of them is going to a 404 page when I click the title (visit the permalink). To see it in action: http://thegrovestead.com/tag/strawberries/ Look for the post "...
0
votes
2answers
1k views

Including all post id's of a custom post type into an array

For my single.php (products.php), I try to build a navigation via which the user can switch between products based on the meta key "price". I want to put all id's of the products post type into an ...
2
votes
2answers
1k 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
1answer
51 views

Custom template for post type not working

I have a post type shopping and in my single.php I am trying to get a certain template for this post type. So I did: \\ in the single.php get_template_part( 'template-parts/content', get_post_format(...
0
votes
1answer
33 views

How to use apply_filters?

So I am using a plugin which loads next posts as the user scrolls down in the single.php file. Inside the main php file of the plugin, there is something along the lines of // By default, don't ...
0
votes
0answers
19 views

Single page with subpages

I'm wondering what would be the best approach to create pages that are 'linked' to a single page. For instance, I have a post type called 'books'. On the front end I would like to have pages like (...
9
votes
5answers
21k 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'; ...
0
votes
1answer
25 views

adding custom post type “name” to single template

i created a custom post type called 30 day boot camp using this code: add_action( 'init', 'rt_custom_post' ); function rt_custom_post() { register_post_type( '30-day-boot-camp', array( '...
0
votes
1answer
30 views

Cannot retieve the_content() and the_author() - both returning empty strings

I am creating the following code to display open graph meta data in the header of my single.php page add_action('wp_head', 'mycode_add_og_meta_tags', 5); function mycode_add_og_meta_tags () { ?> ...
0
votes
0answers
27 views

Subpage template for posts

I have a custom post type, and I created posts. Users can view them at eg: /customposttype/post1 /customposttype/post2 . . Now I want to create a template file to view the posts in a different ...
0
votes
0answers
15 views

Having to flush_rewrite_rules() everytime I make custom post type

I keep running into this issue where every time I make a new custom post type, I have to flush_rewrite_rules() for it to have a single.php or I get 404 when I go to view the post. Anyone have an idea ...
0
votes
0answers
16 views

Assigning custom-single.php based on category

The code below looks like exactly what I need but I dont know how to update it to work for 3 custom single.php files plus the default single.php for any other posts not in one of these 3 categories (...
3
votes
1answer
295 views

Listing a post's categories and subcategories

Is there a way to display the parent categories and subcategories for a particular post (ie. for use on single.php). I've tried using get_the_category_list(), but it displays a list like this: ...
0
votes
2answers
4k views

Single page not working for custom post type

I created a custom post type with the following code: add_action('init', 'create_trans_career'); function create_trans_career() { //Arguments to create post type. $args = array( '...
0
votes
1answer
52 views

Load next post by ID on a single page

I hope this topic is not duplicated. I see some similar topics but non of them can solve my problem, so I decided to put a new one. Here's the case. I have a single.php post with the defualt ...
0
votes
0answers
23 views

Get current category for post with multiple categories (custom taxonomy)

I have created a custom taxonomy for services and a custom post type of service, there are currently 6 categories within services and each post can be assigned to multiple categories. What I would ...
11
votes
3answers
1k views

What is singular.php?

From 4.3 we have a new template, singular.php. I tried to understand what is it, but I didn't get it. :) The page.php for pages. The single.php for every post types. If we have single-[post-type].php ...
-1
votes
1answer
56 views

WordPress More tag doesn't work on Single post

When I add read more on my post (single.php) I can see < !--more-- > in HTML editor and when I publish it, I don't get to see it on my website. I already tried several plugins to solve this ...
0
votes
2answers
52 views

Multiple comment forms on a single page

I have to load multiple posts on a single page. The situation is different. The client ask to reorder the posts, that the current post of the category becomes first and all the rest are next. Then on ...
0
votes
0answers
125 views

get_adjacent_post - in same term or category not working

I am building a Next and Previous Post navigation for my 'Single post' pages, inside a plugin. What I am trying to do is get the Prev/Next post within the same category of a Custom Post Type. So I ...
3
votes
3answers
11k views

Custom post type single-{custom}.php not working

I made a custom post type with the machine name special_media_post and wordpress is simply not seeing the single-special_media_post.php. I am at a complete lose. It keeps defaulting to the index.php ...
0
votes
1answer
189 views

Add inline style to get_the_category_list

I need to style the get_the_category_list() a tag but can't seem to find a way. This is my code: echo '<ul class="list-inline meta-list">'; // Get the categories $terms = get_the_terms(...
0
votes
1answer
151 views

Single custom post type page redirecting to 404 page

I have declared post type as below: $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, '...
1
vote
1answer
116 views

How do I get the category URL from get_the_category?

My loop below shows the latest 4 posts from the same category as the post currently being viewed. Its located within single.php. I'm trying to get the URL of that same category so I can link back to ...
0
votes
1answer
42 views

Single.php category entries not showing right colours

I am trying to implement a way of having different colours for different categories in single.php. So, I have created a colour Picker field with Advanced Custom Fields and this field shows on each ...
0
votes
1answer
24 views

How to set class to “current-page” on the currently viewed single post within a CPT

I have a custom post type, "case". I'm currently editing the single-case.php file and in my sidebar I have the following piece of code: <?php $case_query = array ( 'post_type' => 'case', ...
0
votes
0answers
21 views

Error 500 in single post page after deactivating Wp Cache Plugin

Everything was fine in my blog, until I deactivated the Wp Cache plugin and it suddenly stopped loading every single post pages. It simply appears Error 500 and do not load anything at all, as you can ...
1
vote
2answers
3k 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 ...
0
votes
0answers
33 views

Custom post type single page - always show latest post

I have created custom post type 'products' and template: 'single-products.php' In this template file I have a code: <?php the_post();?> <h1><?php the_title();?></h1> <div ...
1
vote
1answer
7k views

Proper way to load a single post via Ajax?

I'm loading single posts via Ajax into a div that I have set up on my index page. Everything is working fine in this regard. I want to use history.js to push/pop the state so if users enter example....
0
votes
1answer
18 views

DIVs not showing correctly on CPT?

I've been trying to figure out a little problem since yesterday. I made a CPT that is supposed to be posts that are styled and use the same template as regular posts in wordpress. When I bring up ...
1
vote
3answers
558 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 ...
0
votes
1answer
27 views

How to Manually Code Shortcode?

I'm looking to insert a function which is otherwise denoted as a WP shortcode. The page is failing to display entirely when this code is inserted. Here is the full code which comprises the shortcode: ...
0
votes
1answer
43 views

Link from archive-page.php to single-page.php

I have archive-page.php, where my custom posts are displayed. I want to put a link on my image, <a href="" alt=""><img src="" alt=""></a>, which leads to single-page.php for that ...
3
votes
1answer
263 views

How to modify single.php in a child theme?

My WordPress site uses a child-theme (of the default twenty-sixteen) and now I would like to insert a new line into the single.php file. I know that it's better to use the functions.php file of the ...
0
votes
4answers
2k views

Pagination on Single Post

I'm looking to set up pagination on my single.php file so I can have my infinite scroll function correctly. I know that pagination can be put on a single post but I somehow need to make the single.php ...
0
votes
1answer
50 views

Display Taxonomy Term for CPT on single-CPT.php

I've been having issues with this all morning and need some help. So I made a custom post type called Equipment, then made a custom taxonomy called Equipment Types. On single-equipment.php I can get ...
0
votes
1answer
77 views

List posts of assigned categories in list of all categories on single.php

here's what I'm trying to accomplish: I've got several categories, each of them have several posts. Now, on category.php I'm able to output a list of all categories and, inside this list, show a list ...
0
votes
2answers
97 views

Using single.php from plugin folder instead of default template folder

I am trying to figure out how to use another single.php for a custom plugin I'm making. It's for a custom post type. Because if people install this plugin, they won't have the custom single-product....
0
votes
1answer
148 views

Load different single.php templates according to post layout selection

I have created a way of choosing different layouts for posts(sidebar right, sidebar left, full width). This is done through a meta box that displays radio buttons with an image for each layout type. ...
0
votes
2answers
3k views

Custom single.php files for different post formats

I have 3 custom post formats. One is for image, one for video, and, one for gallery besides the default post and they each have a view comments link on the bottom right corner at the end of the post. ...
0
votes
1answer
19 views

Wordpress not using edited image

I have uploaded a picture to media library and cropped the image in wordpress editor but when selecting the edited image http://mariehelenesund.se/wp-content/uploads/2015/11/Kicki-e1447542665309.jpg (...
0
votes
1answer
311 views

pagination redirecting from page number url before page requested

I have a CPT called staff. On their single-staff.php pages i have a list of items they are related to. This has become too long so now we want pagination. I can create the page links fine but it ...