I have a custom post type. It has heirarchy enabled as well as page attributes. Your widget is only showing me these options https://upcraft.d.pr/PgExl1 to sort by name, created, count, slug. We are using a drag/drop page order plugin and we need to be able to sort by page order none of these are working for us.
Order posts under categories by “page order”
Resolved
OnPoint Plugins
Hi Steve,
Can you confirm if you are trying to sort the posts which are displayed under categories, or the posts shown using the Pages widget?
Steve Reinhardt
We’re trying to sort posts which are under categories. We’ve re-ordered by page id in the backend admin and looks good, but we don’t have an option at the widget-level to sort by page order.
OnPoint Plugins
Hi Steve,
The ordering options in the categories widget are just for categories, not the posts shown under the categories.
You may order the posts under categories by page order by adding the following filter to your active theme’s functions.php.
Have a great night!
Steve Reinhardt
One more question… And thank you for your speedy help!
We decided to go the page-based route instead to have more sorting abilities. We’re now using the pages version of the widget and have set a master top level parent with the “show the same on all pages” box checked. We now have an additional slug we’d like to remove from the URL structure https://upcraft.d.pr/IuWT7h https://rescale.com/docs/main/rescale-basics/post-job-cleanup/ where /main/ is what we’d want to remove as it’s an added level that front-end users are unaware of and overcomplicates the URLs. Do you have a functions snippet to remove this by chance?
OnPoint Plugins
Hi Steve,
Adjusting the URLs of page or post types is simple enough but can be prone to side effects. Mainly the result from the
get_page_by_path
function is always 0 if a parent page is missing from the URL, which prevents pages from loading.The filter for remove
/main
for the URL is as follows:In theory, if you provide me the slug of your custom post type, I can write a set a filters which will adjust the query to support a URL without the parent page it in.
Another option is to use the Custom Permalinks plugin to manually change the URL of the desired pages. The downside is you have to manually change of the pages. Looking at the code inside this plugin, it runs some pretty heavy queries, so you’ll only want to use it if you have persistent object cache enabled.
Steve Reinhardt
This is great thanks! The CPT slug is “docs” and we are trying to avoid the addition of a plugin so custom filters would be great if you could help with that. Thank you for your continued support on this!
OnPoint Plugins
Hi Steve,
If you add the following filters to your active theme’s functions.php file:
main/
part of the URL will be removed for links.main/
being included in the URL.These changes will only affect post within the “docs” post type.
Have a great weekend!