add_action( 'init', 'my_new_default_post_type', 1 );
function my_new_default_post_type() {
register_post_type( 'post', array(
'labels' => array(
'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
),
'public' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => array( 'slug' => 'blog' ),
'query_var' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
) );
}
After doing so, all the blog posts under websiteurl.com/blog/postname would return a 404 error. So to fix this, I re-saved the permalink structure in the wordpress reading settings to Post Name. This fixed the issue so I am now able to load posts with this new slug, but now I have 2 x posts links in the wordpress menu and posts with and without this new slug are loading! So I have duplicate content...It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I don't think I can help you with this one as you are doing "register_post_type" so this is exactly what should happen.
You need to ask on general WordPress forum how to safely achieve permalinks that you need. For sure this is not best way to do it.
With kind regards.
With kind regards.
Thanks
It sound simple :-)
so with this line in the forum:
'rewrite' => array('slug' => 'portfolio', 'with_front' => false),
Do you know where exactly would I add this? Is it to the .htaccess file?
Sorry to ask
Thanks
Find there
'rewrite' => array( 'slug' => $album_slug ),
line ~52and also
'rewrite' => array( 'slug' => $work_slug ),
line ~156And add in both cases missing part
, 'with_front' => false
.Refresh permalinks settings, and tell me how it went :-)
With kind regards.
Thank you so much!
You probably missed this change As explained here http://stackoverflow.com/questions/15617820/wordpress-custom-permalink-for-just-posts#15619416
With kind regards.
yes I have both these lines in the plugins php file just as you said:
'rewrite' => array( 'slug' => $work_slug, 'with_front' => false ), 'rewrite' => array( 'slug' => $album_slug, 'with_front' => false ),
Thats why I was confused as this was already in place.
Thanks to you I have learned something new:-)
Do what follows:
Go to : wp-content\plugins\a13_framework_cpt\a13_framework_cpt.php line ~182
Find there: change it to: Same thing you can do for albums in line ~90 but you have to use different unique slug if you want to change it also.
Remember to refresh permalinks after this change! It means set them to Default, save, set them back to what you want, save:-)
I think I will add option to change these slugs to theme in future, as I didn't know it was possible before.
With kind regards.
Ok sure I shall give this a go and let you know in an hour or so!
Thanks again
this worked perfectly thanks!
One issue I am having now though (although its not a huge one) is that I would like to be able to link to the work type/portfolio categories individually from within a single page. So in a blog post, or a single page somehwere on the site, I would like to add a link that shows all the porfolio/work categories within Web Design for example.
To do this, I am using a relative path for the work category, that shows up when you hover within the portfolio/works list.
For example, when I hover over the Website Design tab in the categories list on works/portfolio page, the link in the bottom of the browser displays as: "http://www.myurl.com/work-type/web-design/", so when I then set the link within a page on the site to go to ../../work-type/web-design, for some reason on click, this does a 301 redirect and goes to http://www.myurl.com/portfolio/web-design (I assume due to this recent update), which results in a 404 as there is no child page within portfolio.
Any ideas how I can either cancel the 301 redirect so it loads the path correctly, or how I can set the link in another page so it loads the correct URL for the category?
Hope I have explained this ok, I refer to Portfolio/Works here so you are familiar which page this is, but for the record the theme's works page's slug is currently set to Portfolio.
Log in details are in the PM I sent you a while back but let me know if you need this again.
Thanks
Next thing now is to work out if there is a way to have the categories show up in the page still, as now its set this way, it only loads the images within the web design category and not the list of all the categories.
One way I thought it could work would be to add a query string within the hyperlink instead, so it could load the page and then perform the category selection function. A bit like this:
http://www.myurl.com/portfolio/?work-type=web-design/ but obviously this doesn't work!
The screenshot below shows how i'd like it to load vs how it currently does
How it should be: https://cl.ly/0g1L1Z2G1l1g/Screen Shot 2017-03-08 at 18.46.38.png
How it currently is using a relative path: https://cl.ly/3b0W1g243d3e/Screen Shot 2017-03-08 at 18.56.09.png
Any ideas?
Thanks
So you don't see list of categories in category view, cause it displays only child categories(if there are any). It is made that way so one could create multiple albums/works list.
If you go to fatmoon\parts\category-filter.php line ~41 and change to next do the same on line ~65.
You will see all categories now, however it won't mark current category.
Check if this is what you are looking for.
With kind regards.
Its not the end of the world if the current category isn't marked I guess, I hoped there would be a much simpler solution to go to the page with the child category marked, by using a query string in the hyperlink. Never mind, I shall try this anyway and let you know.
Never mind, it was worth trying at least. Thanks anyway
With kind regards.