Wordpress custom post type page - wordpress

When creating a custom post type and fill it with some posts wordpress generates a page for that custom post type.
But I want to be able to add content to that page so I create a regular page and choose a template where I manually call the custom post type posts and loop them out. And now I can just add content in the wysiwyg editor. But this causes a conflict between these two pages, especially if the CPT has the same name as the page.
And now the question: Is there a way to always show the page where I have chosen the template for the CPT to always show? Even when someone try's to manually enter the url for the CPT generated page?

Here is what I understood from your question. You have custom post type. Then you created a page-template, that loops through your custom post types and output them. Now when you create a new page and assign it the page-template you have created you run into problems, if it has the same name as the custom post type.
Solution: I think what you need to do is change the custom-page slug from the admin menu. Then you would be able to directly reference it by the URL.

Related

How do I select a Wordpress page to act as a custom post type archive

I have a custom post type that I would like to have the archive page be based on a page template. So that I would create a page using a template, and then assign that page to act a custom post type archive.
I see this being in done for WooCommerce where you select which pages are to be what section, or in buddy press.
but not sure how to go about it with general custom post types and archives.
There are two ways:
1.) If the page template already contains the custom loop which calls those CPTs, create an empty page in the WP backend and select your page template as its page template.
2.) Or rename your page template php file to "archive-xxxxx.php", where "xxxxx" should be replaced by your CPT name. (see also https://developer.wordpress.org/themes/basics/template-hierarchy/ for details).
What you can do better is set the archive to false and create a custom loop yourself. you can insert it via a shortcode (woocommerce used to do it this way too).

Wordpress - How to create custom post type without creating page

I want to create a custom post type to manage some things on wordpress. But i don't want that the post create a single page to each and single one.
How can i disable this function of wordpress?
While creating the custom post type, You can disable the permalink section. Please check on this thread,
https://wordpress.stackexchange.com/questions/108652/remove-custom-post-type-permalink

Need to clone a existing wordpress admin page

I need to create a new page which will have same functionality of one the page of admin.
I have a page which is accessed by /wp-admin/post-new.php?post_type=shop_order.
I have made a copy of this page by the name "new-post0.php" but when I access new cloned page , its content is different!
I m missing something at registering this new page?
You shouldn't copy and paste Wordpress core files. That's called "hacking the core" which is very very bad.
http://websynthesis.com/dont-hack-wordpress-core/
You should instead develop your "new-post" page as a new custom post type.
You can learn about them here:
http://codex.wordpress.org/Post_Types
The link /wp-admin/post-new.php?post_type=shop_order you posted refers to a new post page for a custom post type.
To get another page like that, you'll need to create another custom post type and add the custom meta fields.
If you can't code it, there are plugins that you can use to achieve the same results.
Custom Post Type UI to create custom post types and ACF for custom fields. Right now, you should download ACF from Github.

Wordpress template page for custom posts

I have a custom post type (that I'm using on a template page), the custom post type is called 'Headerhome'.
When I post say a gallery there I'm trying to get it to redirect to 'single-Headerhome.php', yet it always just goes to 'single.php'.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
I'm really confused, I'm not the best at WP yet so when something simple like this doesn't work I have no idea how to fix it, even after pouring over the codex for an hour.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
Reading this implies that you have a home.php file in your theme, which would automatically display as your front page of your site. This may not be what you desire? More on this here: http://codex.wordpress.org/Creating_a_Static_Front_Page
An example of a custom post type might be an Event. The Event might have custom fields associated with it, like Location, Date, Time, Description. We would probably want new Events to show up on our front page, but also would want to create a custom theme file so when a user clicks on an Event from the home page to view the Event then the Event page shows our Date, Time, Location, Description, etc. We would then create a single-event.php to do this and put in any custom code their.
So (another example), a custom post type of Fruit would have an associated theme file of single-fruit.php. If their is no single-fruit.php then Wordpress will use single.php as the default theme file to display. More on this here: http://codex.wordpress.org/Post_Types#Template_Files
Hope this helps set you in the right direction.

custom post types wordpress

I have created a custom post type called show.. How do I tell wordpress to go to show.php for loading the content instead of single.php?
This is crucial since single.php does not carry the code for the extra added fields I have, thats why I want to use show.php
thanks
The WordPress docs say your template file must be single-show.php, not just show.php.
single-<post-type>.php
The single post template used when a single post from a custom post type is queried. For example, single-books.php would be used for displaying single posts from the custom post type books. index.php is used if the query template for the custom post type is not present.
1.Copy single.php.
2.Rename it single-show.php.
3.Now modify this template as per your requirement.

Resources