Custom Post Types and Template Hierarchy - wordpress

On the following dev site, I set up a custom post type for "Articles". The post type name is "zu_articles" and the slug is "articles". Everything is working in the Dashboard and I'm able to generate a listing of articles. But when you click the article link, it goes to a 404. I have the following page created: single-zu_articles.php based on my understanding of the WP template hierarchy. I also have single-aricles.php if it is based on the slug and that doesn't work either.
http://zimmernutrition.com.s137737.gridserver.com/
There is a "Latest Article" widget under the content slider on the right to see everything.
What am I doing wrong?
Thanks
Brett

Okay, you're not going to believe this...did some more hunting on StackOverflow and found this post:
Wordpress -- permalink with custom post types
All I had to do was resave my f'n existing permalinks in the Dashboard.
Thanks for staying with me. With I understood why this had to be done and why it fixed it.

Related

How do I find the parent URL on a webpage (Wordpress)

I am working on a website for a company right now and I am running into this issue:
The original URL is similar to this: mysite.com/industrial/ where industrial has 4 subcategories which each have 2-6 pages within them. I changed the original URL to mysite.com/products/ but the subcategories and pages within are not changing to include products in their URL - they still use industrial.
For ex.: mysite.com/industrial/abc/ should be mysite.com/products/abc/ but it stays as mysite.com/industrial/abc/ after I made my change.
I assume that the subcategories are in a folder called industrial (I did not create this website so I do not know), however I can't find that folder anywhere and I'm not sure where to look. I have tried to go in to each of the subcategories and change their URLs, but I can only edit the abc part of the URL and I can't touch the rest.
** This was all done on Wordpress with a custom theme created by another company. Thank you in advance for any help you can offer!
EDIT: For anyone who is also struggling this problem this is how I solved it:
Go to Plugins -> Plugin Editor
At the top there was an option called "Select plugin to edit" -> chose the one that is custom to your website
I found the information that was suggested by Phil in the comment section on this website
I updated the names of my fields in the rewrite permastruct section for register_post_type as well as register_taxonomy
Update the page and flush your permalinks and you should be good to go!
Check what is the defined slug when registering the custom post type.
Whenever a new Custom Post is added through a plugin or them, then the permalinks needs to be flushed.
In the WordPress admin area, go to “Settings > Permalinks”. Click “Save Changes”. The permalinks and rewrite rules are now flushed.

WordPress Blog Slug Issue

Recently I have made a website and since then I am trying to post my new posts on my blog page but it's not showing there.
I have updated settings also where I have made my blog page as a post page.
Whenever I am trying to go to my blog page from my website it is showing index/blog/
And parent directory underneath that.
If anyone can help me in this I would be more than happy.
Check if the Permalink is set to Post Name. If not try to set Post Name as Permalink from Settings > Permalink. (https://i.imgur.com/jJZ9wJo.png)

How to fix permalink structure in WordPress for the upcoming events and photo gallery?

We are using a calendar plugin to display upcoming events for a WordPress website.
The individual event page has the default URL structure as https://www.example.com/event/event-name-1/
Following are the settings on our client's website:
The blog page is this: https://www.example.com/blog-page/
The permalink structure is: https://www.example.com/blog-page//%category%/%postname%/
The event page also follows this permalink structure so the events URLs are: https://www.example.com/blog-page/event/event-name-1/
I want these URLs should be https://www.example.com/event/event-name-1/ (meaning, event pages shouldn't list under blog-page)
I tried following:
Setup the custom structure as /%category%/%postname%/ and added
category base: /blog-page/
This fixed issue with the event's URLs; but then it breaks the permalink structure for the blog posts.
I am getting the same issue with the photo-gallery as well.
How to fix this? Is there any plugin available?
I found a fix to this issue.
It is related to WordPress Custom Post Type and this article on WPBeginner helps to fix it.

Assign a parent page to all WordPress posts

I am building the actual Website as well as the blog into a single WordPress theme. I've got everything setup, there is a blog page (www.mysite.com/blog/) which is set as the "Posts Page" and all the posts are displayed on this page as excerpts.
However, each post has the following URL: www.mysite.com/post1/, I need all post to have the blog page as their parent, so that their URLs will change to: www.mysite.com/blog/post1/.
How can this be done?
Thanks in advance
Willem
You can do this easily by changing your permalink structure. Just include /blog/ at the start of your custom structure.
It seems to only affect posts and not pages, which is what you want.

Change permalink for custom post in Wordpress 3.5

Please forgive me if this problem has been solved, but I searched and none of the solutions presented here seemed to match my situation.
I had a plugin programmed to create a custom post type called "Exercises". When I first create the post, the plugin assigns the title to the post URL. For example:
mysite dot com/?exercise=pushups
The permalink setting are the default mysite dot com/?p=123, but the plugin somehow assigns the custom post title to the URL so it appears as shown above.
With a regular post, I'm able to change the post title and the permalink is changed. However, the problem I'm having is I'm unable to edit the URL title with the custom post after initial creation. For example, I was hoping for this:
mysite dot com/?exercise/%postname%/
Where I can edit postname directly from the post admin page.
Does anyone know what could be causing this and where I could make the changes? The programmers suggested that it would require nginx rewrite configuration (which they are not familiar with. Is there any way to change this so I can edit title after I've created the exercise? I tried changing the permalink settings but that made the custom plugin not functional.
Thanks in advance!

Resources