Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [single]

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

0
votes
1answer
14 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 ...
0
votes
0answers
26 views

Add hide featured image option

Hello, I wold like to add a check-box or button to have a choice between hide or display featured image in single post. i'm in wordpress 5.0.2 This is the code of my simple single.php in the theme : ...
1
vote
1answer
44 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
50 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 ...
0
votes
0answers
29 views

how to show custom post type show in single.php

i create post type services when i remove the slug then it would not show singular post but it is not showing post in single.php function na_remove_slug( $post_link, $post, $leavename ) { $...
1
vote
1answer
55 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
28 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
24 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
0answers
33 views

Why my ``single-events.php`` not working?

i made child theme and i created single-events.php file for my custom post type events but it not working in child theme can anyone please help what can be problems or i missed something? my custom ...
0
votes
1answer
174 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 ...
0
votes
0answers
13 views

Need to make two dependent selects with dynamic content

I have two select dropdowns, one of them for device type(smartphones,cameras,PC etc), second are models for every device. The first select(Device) will be disabled for selecting, so if nothing is ...
2
votes
1answer
24 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
43 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....
0
votes
0answers
21 views

Wordpress post archive permalink modification, how to add previous page to single.php url

The current url that links to my post loop is home/sub-page/posts, but when you click a single post's permalink, it takes you to home/posts/single.php. How can I make it so that the sub-page is still ...
0
votes
0answers
15 views

Custom post type single post to url rewrite base on meta query

can someone help me writing rewrite queries. I have a post type called chef-list, and it has a meta key chef-type meta values for chef-type are 'restaurant', 'host', etc... What I wanted to happen ...
3
votes
1answer
29 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
31 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
112 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
42 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
23 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
23 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
88 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
0answers
18 views

Using Classes in single-{CPT}.php

I am using a class for retrieving post data in plugin-folder > includes > PostData.php and I have a single page for custom post type plugin-folder > single-look.php Now i want to use that ...
0
votes
2answers
19 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 ...
0
votes
0answers
49 views

Pagination <count page> in Single Template Post not work <AJAX>

at first i just want to say my english isnt very well so my apology for that :) My problem: I want to create in single post overview another posts with settings 4 posts per page + this overview i ...
0
votes
0answers
9 views

change blog post link to direct to woocommerce single-product-page (or any other page) instead of single-blog-post-page

My blog page consists mostly of art prints. There is a short description and the image. There is no need for anyone to go to the single-post-page for it because it appears fully on the blog page. ...
1
vote
1answer
28 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 ...
0
votes
0answers
95 views

How do I check if a post is password protected?

I am checking to see if a post is password protected and if it is I will display the form, if not the post will be displayed. However after the password has been entered the user is not taken to view ...
0
votes
0answers
20 views

I want to signin from first wordpress site to other wordpress website without registration..without using network mode

i have a wordpress website installed (without multisite wordpress network feature) on server so i want to login to other wordpress website with same credentials.. in-details: i want to create a link ...
0
votes
1answer
49 views

Add custom field information to source meta data

I try to add information from a custom field into the metadata in the source code. While searching for the solutions I found some. As I am not really an expert I ask you guys. I want to add ...
0
votes
1answer
63 views

Conditional: IF current user has NOT commented on current post (not including post author)

I'm trying to find a way to have a conditional snippet in single.php where //do something happens if the current user has not commented on the current post. I'm hopeless at coding but I'm guessing I ...
0
votes
1answer
29 views

custom post type single page

I have a custom post type called "listing" and am using a template called content-own.php to display all of my listings. In that page I am using: <a href="<?php echo str_replace( home_url(), '',...
0
votes
2answers
191 views

custom post type single post preview for pending status

I have created custom post type and created the post in a front custom form using logged in user and set status 'pending'. Now I want to show my created post preview like the published post. I have ...
0
votes
0answers
32 views

The content structure for pages and post

In each of my Wordpress sites i stumble across a similar problem about the structure of my page/post content. A simple version of the question is what is the best structure for a site with 50+ pages ...
1
vote
1answer
394 views

How to delete read more span on single post view?

How could I complete delete following line on single post view? <p><span id="more-XXX"></span></p> I need to delete whole span tag. Is there any other option than ...
0
votes
1answer
29 views

Try to showing product file size on product single page

i have new site for freebies so all people can download file direct on my site. I'm using woocommerce to share these file, and now i want to showing file size on my single product page. This my code: ...
0
votes
0answers
154 views

Custom post type single post add slider in e certain category

I got a problem with my custom post types, I want to show the same slider I did put above the custom category archive page. The template it uses is called: taxanomy-vakgebied-civiele-techniek.php. ...
0
votes
0answers
37 views

single page not found in custom theme

I created custom theme. when i click on the post title single page not found. my question is: how to create single.php of custom theme? Here is the single.php: <?php /* * The template for ...
0
votes
1answer
32 views

How to use a capture from a rewrite rule inside a php file (like single.php)?

My rewrite rule to make a convenient url for deep-linking into podcasts add_filter("rewrite_rules_array", function($rules) { $newRules = array(); $newRules["(.*)/time/([\d|\:]+)s?$"] = '...
0
votes
1answer
32 views

Insert sometext after first h3 in content

I try to change something my wordpress page. I'm always writing contect with h3 tag but mutiple like each post 3 times 3h. I want to add some text after first h3 tag. function add_content_after_h3(...
0
votes
2answers
90 views

Need to display same custom post type on 2 different singles templates

I have a client who wants to display home plans (a custom post type) on their website in 2 differently branded sections, depending on which listing page the post is accessed from. I found this ...
3
votes
1answer
27 views

Which action fire in front-end single post only

I need to add an action in the following situation : When it load a single page post in the frontend, before anything is displayed. I looked the 'the_post' action, but it's triggered at several areas, ...
0
votes
0answers
260 views

Ajax call from single.php to plugin file in the backend

I am creating a button plugin which on-click displays a popup modal. The customers then enter their information onto the modal and click save. After submission, the information needs to be passed to ...
0
votes
1answer
62 views

display multiple posts and posts content on a single URL

How can i display multiple posts and posts content on a single URL. Like this https://www.recruitment.guru/ssc/ssc-recruitment/ showing posts on single post page. Please suggest a solution.
1
vote
1answer
40 views

Link for Most Recent Post

I am trying to make a comic website that has arrows pointing to First/Previous/Next/Latest on single.php. I've linked the first 3, but I'm struggling in figuring out how to link to Latest. It doesn't ...
0
votes
1answer
105 views

Display Some text in some specific category not all category

I want to display some texts in specific category in single post based on category in wordpress.. how can i do that for example posts in news category display some text.(not all category) Thank you
0
votes
3answers
172 views

Can't access private custom posttype single- or archives-page

I have created a custom posttype labeled 'Richards' using a site-specific plugin with the following code. function add_richards_posttype() { $labels = array( 'name' => ...
0
votes
1answer
53 views

Not Able To Render Single-CustomPostType.php File

I have CPT and Custom Taxonomy plugin like below function gen_service_tax() { $labels = array( 'name' => 'Service Types', 'singular_name' =&...
2
votes
1answer
2k views

the_post_thumbnail() based on the Post ID

This is How a code in single.php looks like → But needed that in homepage so I decided to make code based on the post ID → <?php $fpid = get_theme_mod('kirki_fpid'); ?> (The above is ...
1
vote
2answers
2k views

get_terms parent for current product only

I wish someone can give me a clue. I am actually displaying all product category (product_cat taxonomy) on single page products, displaying also childs regarding the product itself. For instance: ...