Questions tagged [single]
The single post template. Used when a single post is queried.
410
questions
0
votes
0answers
8 views
How to fetch related products for single product page
quite new to e-commerce and it’s been a real headache at times 🤯. I’ve managed to get most of what I want displayed and styled for the single product page using elementor and some Jetwoobuilder ...
-1
votes
0answers
24 views
New pages or categories in wordpress posts
Let me show you an example on what I am looking for
https://www.hardreset.info/devices/samsung/samsung-galaxy-a21s/
on the left is the menu. clicking on one of them will get you on a new page.
BUT how ...
1
vote
0answers
14 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 ...
0
votes
0answers
12 views
Exclude Custom Taxonomy Terms from being publicly queryable
I have registered a CPT named 'projects' which is publicly queryable.
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'...
0
votes
1answer
9 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 ...
0
votes
2answers
37 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 ...
0
votes
0answers
8 views
How to offer a non-paginated alternative version on paginated (single) posts or pages?
@ll; I'm hoping this is not a too stupid question; I tried googling for solutions and found none.
Paginating longer posts sometimes makes sense to break them down into contextually coherent sections; ...
0
votes
1answer
14 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 =...
0
votes
0answers
8 views
Changing the current Post when loading single.php file
I need the single.php file to be able to load a different Post (Into the POST object) and to consider the new Post as the current post.
Example:
Current Post ID: 755
Select Random Post ID: 748
Load ...
0
votes
0answers
36 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(...
0
votes
1answer
18 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 ...
0
votes
0answers
12 views
Single.php - Back To Category Button
I've used this code to create a back button to my previous category and it works perfectly, but I want the button title in this case hard coded RETURN to be dynamic too TITLED the previous category.
...
0
votes
1answer
32 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"&...
0
votes
2answers
34 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" />
3
votes
3answers
160 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 ...
0
votes
0answers
26 views
How to disable single page for specific posts?
I need to disable single pages for specific posts, but only after specific condition.
My code is here:
add_shortcode('list-posts-basic', 'ant_post_listing_shortcode');
function ...
0
votes
0answers
45 views
Change the columns width in single product page in WooCommerce
I build a store site, on the single product page the gallery images section is smaller that the short description section, so how I can change this to have a bigger gallery section and smaller ...
1
vote
0answers
16 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, ...
0
votes
0answers
15 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() ?
1
vote
2answers
160 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 ...
0
votes
0answers
29 views
Next Previous link in Custom Post types only within same Taxonomy
I use a Genesis theme and Pods templates for custom post types. I have 4 CPTs for different types of Artwork. Within a given CPT I have a pods field to indicate whether the artwork is available or ...
0
votes
0answers
13 views
How to check the date of a post is within the user membeship start date - end date
I have to modify memberships plugin.
A member should be able to see posts (i am talking about posts in the specific category which i limit only for the members), even within this category a user can ...
0
votes
2answers
109 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 ...
0
votes
0answers
21 views
WooCommerce Category page uses Single.php
I'm using WooCommerce on a custom theme and currently all categories pages for it are using my single.php file.
Why would this be? I assumed it would use archive.php
Is there a good way to fix ...
0
votes
1answer
54 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', '...
0
votes
1answer
25 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 ...
0
votes
0answers
36 views
how to hide some category in single page wordpress
i want hide some cat in single post. in my theme use bellw code to show post cats.
can help me?
<div class="crumbs"><a href="<?php bloginfo('url'); ?>">home</a> <?php ...
0
votes
2answers
48 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 <...
0
votes
1answer
50 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 ...
0
votes
1answer
38 views
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:...
1
vote
1answer
62 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 ...
0
votes
1answer
60 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 ...
1
vote
1answer
43 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.
...
1
vote
1answer
615 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 ...
0
votes
1answer
164 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 ...
0
votes
0answers
287 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 ...
0
votes
1answer
407 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 ...
0
votes
2answers
57 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 ...
0
votes
0answers
19 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 ...
0
votes
1answer
77 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?
0
votes
0answers
137 views
Modify post template on Divi Theme
I'm using the Divi Theme on my site and i want to add some code on the posts template. I know i'm supossed to modify the single.php file, but anything i do on the file doesn't work. I even tried to ...
0
votes
1answer
53 views
404 error on published page with specific permalink
I am experiencing a strange error with my Wordpress install.
I've got a dozen of pages, %postname% permalink structure, everything works fine.
For one of the published pages, I reverted it to draft ...
0
votes
0answers
67 views
Single post shows post three times
Not sure exactly what happened, but my site shows the single post content multiple times. Example. Reinstalling the theme didn't help. Also, it's not happening with any other theme, only with the ...
0
votes
1answer
23 views
Defined function isn't showed on page
I've defined a function in function.php and then I tried to call it but it's not visible when I call it.
This is the function
function social_sharing_buttons($content) {
global $post;
if(!...
0
votes
1answer
441 views
How to display different blocks for mobile and desktops
I want to display a fixed banner from the bottom left of the screen. But at the same time, the banner is different for desktops and mobile devices.
Please tell me. How can I determine the user's ...
0
votes
0answers
284 views
Using AJAX on frontend: Synchronous XMLHttpRequest deprecation except for admin role
Everything is happening in single.php. I have to validate if user has subscribed to the webinar and show login button accordingly. It's on the frontend.
I'm doing this on document ready:
<?php if(...
0
votes
1answer
205 views
two col layout bootstrap 4 with one fixed col and fade in effect on image
I've created a layout for my single post that have a fixed column and another that contains images that has the vertical scroll. I'm using viewportchecker to check if the images are inside the ...
0
votes
3answers
792 views
Post Template Query with WP_Query?
I've seen this solution for querying pages based off of template type: Page template query with WP_Query
I'm having trouble getting it to work with posts, that are using a "Single Post Template:" ...
1
vote
1answer
383 views
previous/next_post_link in the same sub-category?
As the title: is there a way to navigate between posts of the same subcategory using the previous_post_link and next_post_link functions? But maintaining however both the category and the sub-category ...
0
votes
1answer
126 views
How to backup single post in wordpress [closed]
Please Advice me. I wanted to backup single post with data and media file.
But not link with original post.