Questions tagged [single]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
12 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
10 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
34 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
14 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
26 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
43 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
0answers
15 views

How to add category pagination under single post?

I don't want to split the post, my purpose to add the category pagination under each post is simply click on 1,2,3,4,5.... pagination and go to the exact page of the same category. Let me explain ...
0
votes
1answer
24 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:...
0
votes
0answers
23 views

Plugin Events Manager: Output custom HTML in single-event.php

I am using the WordPress plugin "Events Manager" (https://de.wordpress.org/plugins/events-manager/). created a single-event.php file in order to have a custom event single page. My code: <?php ...
0
votes
0answers
25 views

Split post template in two pages

I need to split my single post template in two pages using pagination . It's very simple in post editor by <!--nextpage--> But i want to do it in single.php file So the page content in first ...
1
vote
1answer
20 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
33 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 ...
0
votes
0answers
18 views

Getting the next/prev post in the same last taxonomy term

I have a custom taxonomy 'offline' custom post type 'lessons' and every post has multiple terms offline >> term 1 >> term 1.1 >> term 1.2 >> term 1.3 >> post and I ...
1
vote
1answer
28 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. ...
0
votes
1answer
143 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
82 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
109 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
107 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
41 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
18 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
42 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
98 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
41 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
45 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
20 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
119 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
220 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
103 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
391 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
271 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
61 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.
0
votes
1answer
20 views

How do I find a way to create a global single.php for a custom post type?

I am working on making a custom post type plugin for my website. However, I want to make it universal for any theme I may decide to change. Or to be able to append the post type to a single post file ...
1
vote
1answer
222 views

How To Pass Current Post Type ID from Single Template To Custom Page Template

Having a Custoom Post Type called movies, I am able to get the current Post ID in my single-movies.php template. Now can you please let me know how I can pass this post ID from the single template to ...
2
votes
1answer
492 views

Show all posts in sidebar in single.php

Wordpress 4.x Why does the loop.php only show the current post in the sidebar when I view a post in single.php? I have: Post One Post Two Post Three If I view "Post One" (single.php), the sidebar ...
1
vote
1answer
63 views

How to check the terms in single custom post type template

I have custom post type called events it has event_type taxonomy with two terms namely past-events, upcoming-events. I want to check my single post's term whether it's under past-events or upcoming-...
-2
votes
1answer
75 views

How to display <div> before H1 Title

I need display custom block before H1 Title in my posts. Please, tell me. Is there any function or hook to implement this? I cant edit file single.php, because I create different single templates ...
0
votes
1answer
32 views

Why custom post redirecting to index page?

i am new learner and trying to build a wordpress themei need your help in theme building ,my problem is that, i created a custom post type name is events and also created a single-events.php template ...
0
votes
1answer
597 views

LinkedIn Share Post Button

Hi there I have been having trouble with a LinkedIn custom share button. My theme didn't seem to provide one and I like this theme so wanted to create my own. I have gotten as far as getting a window ...
2
votes
1answer
29 views

Display only entire most recent post on author page?

Is there a way to display only the most recent post in its entirety on the author web page instead of all the posts? In other words, I would like the author web page to look just like a single post ...
0
votes
0answers
102 views

How to make “single post” permalink maintain it's sub-page structure

I have a custom post type called "Classes", and I have multiple sub-pages for my site for each different schools classes page (which loops through said custom post type) I.E http://www....
3
votes
1answer
94 views

Display Single Attachment Image file size, uploaded date, resolution, file-name etc in Sidebar

Sorry for any wrong details. I am totally new to WordPress development. I am running a photo site. On single attachment page, I want to show the details (i.e upload date, filename, size, resolution) ...
1
vote
1answer
109 views

Programmatically rewriting slug through functions.php but returns 404

I wanted to change the slug of a certain post type (in this case, article) into whatever a certain value in its custom field. I went to functions.php and put this code. function na_remove_slug( $...
0
votes
0answers
197 views

customize src attribute in woocommerce single product image

I need to add suffix to the end of image file name (in "href" attribute) that show when i click on the woocommerce single product image. *: I'm using Enfold theme and is using magnific popup ...
1
vote
1answer
50 views

Single Template that can be applied only via URL

We want to test different landing pages to display only certain parts of a specific Custom Post Type's content metadata so I need to create templates that are used only when specifically crafted URLs ...
0
votes
0answers
37 views

Assign for all post of a post type a specific single-post template

I have created for my custom post type computer-hardware a template single-Computer-Hardware.php, with the following header: /* * Template Name: Computer-Hardware Post Template * Template Post ...
0
votes
1answer
43 views

How to use single.php for creating, reading and editing Custom Posts with ACF

I have a WordPress custom post type product and I am now developing front end forms for creating, reading and editing these posts (I am using ACF). I am trying to use only single-product.php for this ...
1
vote
1answer
349 views

How to show the archive / post type description on Single templates

I have a Custom Post Type with an archive description. Both the following functions return said description from the archive-cpt.php template, as expected: the_archive_description() echo ...
0
votes
2answers
96 views

Is it possible to customize the post according to post format in single.php?

First let me know you that I have made a blog before and I have customize it according to the post format but I have customize it on the blog main page i.e. index.php. Now I am making a another blog ...
1
vote
1answer
53 views

How to show “teaser” posts on blog / archive pages, otherwise full posts

Forgive me, I'm a PHP noob and writing too much of it makes my eyes glaze over; I'm sure this is a super simple solution and probably a dumb question. I'm working on a custom theme where I want to ...

1
2 3 4 5
8