Questions tagged [single]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

How Do I Prevent Featured Image Caption Displaying Above And Below Image

I'm trying to add an image caption below my featured image on my single posts. I have this working, but weirdly they are also displaying above the image. I'm hoping someone can help point out the ...
Nick Rowe's user avatar
0 votes
0 answers
9 views

Post URL redirecting to homepage

Please I need help, i have added dynamic content using Pods - Custom Content Types and Fields and the post url button is redirecting me to homepage instead of a single post page.
Cathrine's user avatar
1 vote
1 answer
13 views

Custom Post Type - archive working - single is not

So I'm really at my wits end here. I'm trying to get the single page working for my custom post type. I've done it several times now, but right now its just not working (404 - not found). I hope I ...
Keanu1989's user avatar
0 votes
1 answer
199 views

How do I create a single.php file as the default template for single posts in the twentytwentythree theme?

I am trying to create a single.php file to be the default template for displaying single posts in a child theme that I have created from the TwentyTwentyThree theme. The reason I want to set this as ...
Shanahando's user avatar
0 votes
0 answers
9 views

How can i show multiple post on single post wordpress, just like therichest.com or screenrant.com or hotcars.com.?

How can i Show multiple post with same categories using infinite scroll on a single post page.
Ankush Choudhary's user avatar
0 votes
1 answer
1k views

Adding PHP code to single template in 2023 edition of WordPress theme

Im looking at this tutorial. But adding this code snippet to templates/single.html doesn't work. <?php $meta = get_post_meta( get_the_ID(), 'Sponsored Post' ); if( $meta[0] == 'Yes' ) { ?> <p&...
anjanesh's user avatar
  • 111
0 votes
1 answer
444 views

Wordpress Multisite Network Shared Custom Post from Main Site using single-CPT.php

Trying to share a Custom Post from main site to a child site on a multisite network. I am 80% there, with the use of switch_blog I am able to query custom posts on my templates on the child site. I DO ...
sash's user avatar
  • 1
0 votes
1 answer
40 views

the_author() str_replace error

I Am Using WordPress 6.1 In Which I Am Calling the_author() function to get author name in single blog page. The problem is that it works properly when we call it in blog page but when I Call it in ...
Muhammad Uzair's user avatar
0 votes
1 answer
80 views

how show post date for specific post?

i want to show specific post date into my theme not in single.php for example i want to show published date into this : <ul id="post"> <a href="https://www.example.com/ps" ...
Hamoon's user avatar
  • 1
0 votes
1 answer
58 views

Show Next/Previous without Link

I have a question. Currently I have <?php next_post_link('%link', 'Next Post'); ?> and <?php previous_post_link('%link', 'Previous Post'); ?>. Both return Next and Previous with a link. I ...
Jornes's user avatar
  • 743
0 votes
1 answer
15 views

Wordpress giving me the index

i'm having a problem and i can't seem to figure out how to solve it. I'm just beginning to develop custom themes in wordpress and i wanted to create the custom template for portfolio and a single page ...
dev_wannabe's user avatar
0 votes
1 answer
624 views

Pagination in single.php

I have a problem with the pagination on a single.php page. The idea is to have a list of my created posts (the excert, the title and a link to the post) on the post page (single.php) that shares the ...
Adrian's user avatar
  • 3
0 votes
0 answers
18 views

How to save template data into wp_post table (post_content column)

Is there a way to save template data into wp_post table? I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users ...
Morty_Smith's user avatar
0 votes
1 answer
706 views

Give active class to current page on a while loop WP query for custom post types listing

I have a single-programs.php page and at the top of this single page I need to list all the entries from the custom post type "programs". Is there a way to give "active" class to ...
Jorge Monte's user avatar
0 votes
0 answers
30 views

Wordpress - When visiting a `single post/ single.php` my category menu item link becomes active

I'm new to WordPress. So, I'm not really sure if it's normal behavior or not but this is bothering me. So, I've my main navigation menu consists of Home | category_1 | Category_2 | Category_3 ... The ...
Bipul Roy's user avatar
  • 101
1 vote
0 answers
153 views

Remove post templates from the selection box menu when creating a single post

I added some post templates(not coding, using block editor) and now I can't find any options to delete those unnecessary templates.
5hakir's user avatar
  • 11
0 votes
2 answers
82 views

hide specific div on single.php [closed]

I've been working on WP since a week so far i've seen bunch of tutorials and videos about wp but i feel stuck and since i'm a wp noob i cant find or think any solution for a simple problem. i have ...
wp_noob's user avatar
  • 11
1 vote
3 answers
266 views

No matching template found when using single.php

I am building my own WordPress theme. I have the front page working. However, when I try to view a test post full of Lorem Ipsum, I get the "No matching template found" error. I have the ...
N.MORR's user avatar
  • 113
0 votes
0 answers
16 views

Ignore the Ad on Specific Categories

I don't want to display the ad in a few posts for a specific category (cat1, cat2). Here's the ad code to display the ad on single.php <?php get_template_part( 'template-parts/ads/below-header' ); ?...
Kumar's user avatar
  • 15
0 votes
0 answers
96 views

custom wp_list_categories in single.php

I have created a custom WordPress theme, and I am customizing my post page (single.php). I would like to display the parent and child categories and sub-child related to the post (wp_list_categories) ...
Aym Aym's user avatar
0 votes
1 answer
1k views

Wordpress block editor embeds not working in theme (single.php)

I am trying to embed 'spotify' and 'youtube' services in the block editor. When added from the admin, they are displayed fine in the block editor, but when the post content is printed from the theme (...
sariDon's user avatar
  • 265
0 votes
1 answer
65 views

How do I change the template specifically for single posts?

My goal is that when someone clicks on a post, the page they are taken to has no sidebar cluttering the view. I want them to focus on the content. I only want the sidebar to appear on the homepage, ...
Jonathan Wilson's user avatar
1 vote
0 answers
176 views

how to get the categories for a single product in a hierarchical way

It's the first time I write here, but I really appreciate your work from long time. Well, I know there is a very similar question, but I can't get out the solution for my particular case. In a ...
Andrea's user avatar
  • 11
0 votes
1 answer
19 views

Show single post child category from a determined parent

I am trying to show in a single post child category from a selected category. For some single post, I have a category that is corresponding to an area. I want to show that category in a special area ...
Stuart66's user avatar
0 votes
2 answers
1k views

Check If Post Was Published More Than 6 Months Ago Using get_the_date

Inside my content-single template, I have a conditional check that displays text based on how old the post is. The idea is to inform visitors that they might be reading "old" news. Problem ...
Harold Aldersen's user avatar
0 votes
1 answer
32 views

Custom post type single page 404

I have read a lot similar questions, but none of them saves me. The site have multi-custom post type registered, others are ok to load a single page, except one, function cabinet_post_type(){ $labels =...
Hao Phung's user avatar
0 votes
0 answers
45 views

Different template parts when on different pages

I need to get different template parts when locating on different pages, for e.g. Homepage. <?php if (is_home()) { get_template_part( 'partials/hp-header' ) } else { get_template_part(...
Anderson's user avatar
0 votes
1 answer
167 views

How can I include ALL post types in the_post_navigation() links, not just current post type?

I have a site with several Custom Post Types: blog posts, movie reviews & book reviews. In my single.php template I call the_post_navigation(). When viewing a blog post the previous and next links ...
Tantalus's user avatar
  • 151
0 votes
1 answer
38 views

how to loop through this in blog single?

here is the code in single.php and I want to add the loop. anywhere I put endif, I am getting error where can I add it, please? updated code: and many thanks in advance. <div class="row"&...
social's user avatar
  • 61
0 votes
2 answers
238 views

Add get_the_tags() to Single Posts <head> section via functions.php

How to print Posts tags in single posts head section from function.php. <meta property="article:tag" content="Single Posts Tags" />
Puneet's user avatar
  • 47
2 votes
3 answers
443 views

Pull Two Posts Into Custom Post Type `single-cpt.php`

I have a custom post type and in the CPT's single-cpt.php file I would like to pull in two posts instead of one. The two posts will be the post the user clicked in the relevant archive, and the next ...
pjk_ok's user avatar
  • 908
1 vote
0 answers
22 views

Single template showing all posts of that type

I have a custom post type of "Talent" built with pods and advanced custom fields. I'm using single-talent.php for to display the individual Talent. I thought this page worked fine before, ...
Aaron's user avatar
  • 41
0 votes
0 answers
50 views

show related articles in single.php template

How I can show inside the single.php template the related articles? Is there any particular params I can use with WP_Query or get_posts() ?
wpnewbie's user avatar
1 vote
2 answers
2k views

Redirect Single Post CPT (Custom Post Type) to a specific URL

I have a domain domain.com and subdomain materials.domain.com At the domain.com scope, I created a custom post type called resources and a portfolio grid (using Elementor) to display it's featured ...
user1301037's user avatar
0 votes
2 answers
3k views

Limit the number of characters/words in an excerpt for a related posts section

I'm slowly building my own WordPress theme and want to have a related posts section at the bottom of each post (for example here on my site). I am using the following code to generate the related ...
DHazeel's user avatar
0 votes
1 answer
130 views

custom post type - project link output via single-portfolio.php

I have the following code registering metabox with form input used to input live project link function portfolio_meta_box() { add_meta_box ('project-meta', 'Add Project Link', '...
810311's user avatar
  • 41
0 votes
1 answer
132 views

Two different single.php depending on source page

I wonder if I can have two single.php templates for different sources. The problem is: - I have the full website, with the blog and the home.php that opens posts in the single.php template. - Then, I ...
rayago's user avatar
  • 1
0 votes
2 answers
80 views

My single.php page skips the first div tag

I'm currently styling my single.php file and for some reason when compiled the page completely skips the first tag yet prints everything else afterwards, including the <h1> tag in the first <...
Josh's user avatar
  • 1
0 votes
1 answer
73 views

How can I write slugs / permalinks as: custom post type -> custom taxonomy and custom post type -> custom taxonomy (one CPT and many taxo)?

This is my first post, so maybe I'll miss some informations, sorry :bowing. I have almost the same issue as Paul T did (Permalinks: custom post type -> custom taxonomy -> post), namely : I ...
Sioban's user avatar
  • 11
0 votes
1 answer
347 views

&nbsp; &nbsp; &nbsp; &nbsp; out of nowhere

Something is inserting four non-breaking spaces into my single.php code, but I can't find the cause at all. I have already tried to disable all plugins and restore the theme's initial settings. Link:...
Frederico Branquinho Teixeira's user avatar
1 vote
1 answer
482 views

Disable single view for specific post category

I have a post category on my site which does not require a "single" view. I do not want these posts to be indexed or accessible directly because all of the relevant information for these specific ...
user13286's user avatar
  • 255
0 votes
1 answer
354 views

How to put single-***.php in a specific folder?

I am organizing and cleaning my code to make it easier to maintain. It turns out that my site has a lot of custom post types, so I have about fifteen single-***.php files at the root of my site. In ...
Riyacte's user avatar
1 vote
1 answer
115 views

WP Query Category Atribute Not Working

I'm trying to do a query in my index.php page to get some posts from my blogue category. In my other pages this query works perfectly but on the index.php returns the most recent post 3 times. ...
Pedro Ferreira's user avatar
1 vote
1 answer
2k views

Remove single page for custom post type

I have a custom theme with a bunch of custom post types. I want to keep my "news" post type to display as a paginated list (that links directly to the external news article - already figured this part ...
Mike KC's user avatar
  • 13
0 votes
1 answer
849 views

WP posts using index.php instead of single.php

The posts on my custom theme are using the index.php file instead of single.php _ I have looked through at least 10 questions on SO_ although many of them are very old _ Some answers said that if ...
inputforcolor's user avatar
0 votes
0 answers
1k views

get_the_terms child terms for current post/custom post only

Inside a Post / Custom Post type loop, I am trying to get child terms selected on the edit screen of that post/custom post. For Example: Zoologist ( Parent ) Pre Zoologist Post Zoologist Now if ...
Nimesh's user avatar
  • 441
0 votes
1 answer
1k views

Shortcode and get_template_part

I'm developing my own plugin for my wordpress. I create a shortcode for my plugin and CPT with a custom taxonomy and custom single-CPT. When I try to use the function get_template_part() in my ...
Irene88's user avatar
0 votes
2 answers
124 views

loop in single.php of the same category

How can I put a loop in my single.php that shows the posts of the current category of the single and following the code structure that I have? The question comes, because I can not find the correct ...
Dario B.'s user avatar
  • 155
0 votes
0 answers
23 views

Search button click sends to single-custom_post_type instead staying at the same page

I created a template to display search results based on user selects. The problem is after I click on the search button it sends to the single-product(This is a Product custom post type). I also have ...
Testig Content's user avatar
0 votes
1 answer
287 views

How to center all text body in single.php at once?

I'd like to center all of the text bodies (or content body before "read more") of all posts (in single.php) at once with simple (or advanced) code. How can i do that?
vordinerdo's user avatar

1
2 3 4 5
9