I need to rewrite wordpress URL.
Currently My URL is : http://www.example.com/about/?pagekey=team1
and I need like ; http://www.example.com/about/team1
Here About is one page template and I've setup for wordpress custom parameter so, when you pass pagekey to this page it will take key and based on that display result.
Now, I need to show user friendly, can anybody have idea how to do this.
currently my parmalink is set to "PostName".
Thanks.
You should follow the WordPress codex here and create 2 files:
page-about.php
single-about.php (this one will be for the teams)
you should create CPT (custom post type) with all the custom post type fields you need for this eg.
Name,
Title,
Position,
Image,
Tag,
Taxonomy,
.... etc
then you will pass the custom post type query (the query) before the loop and you will be able to access the single-about.php from page-about.php
that'all.
Cheers and hope this helps
Related
I'm a newbie to the Wordpress.
So far I have a custom post type called 'property'. This post type has one custom field called 'property_city'.
In WP-admin - permalink setting, I have selected Post name option. So, posts of this custom post type have URLs like:
http://xxx.local/properties/edge-apartments/
http://xxx.local/properties/northgate-point/
What I want to have those URL to be generated using the city of the property and also I want to change properties prefix with student-properties like that:
http://xxx.local/student-properties/Manchester/edge-apartments/
http://xxx.local/student-properties/Chester/northgate-point/
I have tried various plugin and various code, but none of them worked as expected.
Any help would be appreciated.
Thanks,
try Permalink manager plugin it works for me here is the link : https://wordpress.org/plugins/permalink-manager/
I want to use WP for a site that blog is just one aspect of it, and I don't want requests to home_url list blog posts (post_type=post), I want them be to fetched using another URL.
This topic default-archive-url-wordpress suggest two ways:
page_for_posts option
post_type=post URL query parameter
but I have questions
About the first, How a page would be able to loop into the posts, and where I should update this option (which hook)?
For the second, the guy says that using this param, make the wordpress get the archive for the specified post type, but I think posts don't have archive (according to includes/post.php their has_archive is left to default) how should I change this and also I want to use a permalink/pretty link for accessing posts.
Thanks in advance
Go to settings -> reading, and change the front page displays posts settings to front page displays a static page and then select a blog page.
Easy as pie.
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.
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.
So I've just made a custom post type for my wordpress theme named "Products". When I create a new post in it and view it, the link is something like this:
"http://localhost/wordpress/product/a-product-title"
This page views as expected but when I try to go to the supposed parent page:
"http://localhost/wordpress/product/"
I get a 404 error page. Is there a special template I need to make to view this page?
Thanks
I found what to do. I just created a new page called "Products" and set it as the posts page. Then I put this in front of the loop
$wp_query = new WP_Query("post_type=product");
and it worked
I had the same issue - I think it's down to the fact that right now, WP 3.0 simply does not behave as you would expect with custom post type 'archives'.
Check out Smarter Custom Posts to easily build-in this behaviour.
The name Products is also used by Woocommerce so be aware that if you install this too, the custom post type will stop working.