Xeevee
Forum Replies Created
-
Update,
The problem only occurs when the plugin “Advanced Access Manager” is enabled.
Tax_query is working as intended on all browsers when this is disabled.
However I’m still confused how the WP_Query object could be influenced by a browser?
Forum: Fixing WordPress
In reply to: Pagination not working with "pretty" url structure ?After a lot of Googleing around I managed to find the problem and the solution.
Simply put you cannot have a custom post type’s name and and page’s slug the same.
In my case I had the custom post type “news” and then a page called “news” with the slug “news” to display the custom post type’s posts.
However this causes conflict with WordPress’s rewrite rules and as a result was triggering my 404 error.
The solution was simply to change the “news” page’s slug to “latest-news” or anything other than “news” actually.
No more conflict, and working pagination! =D
– Jack
Forum: Fixing WordPress
In reply to: Create Custom Posttype with no permalinkFor anyone who may be interested in this problem, I’ve come up with a solution, it’s not ideal, but it gets the job done.
First I created my custom post type of the type “socialmedia”
Then in my themes functions.php I’ve added the following function:
/** * Removes the permalinks display on the socialmedia post type */ add_action('admin_init', 'remove_permalink'); function remove_permalink() { if($_GET['post']) { $post_type = get_post_type($_GET['post']); if($post_type == 'socialmedia' && $_GET['action'] == 'edit') { echo '<style>#edit-slug-box{display:none;}</style>'; } } }
This simply checks if you’re on the edit page of a post of type “socialmedia” and if so, sets the Permalink’s containing div to display none.
Next, I create a file “single-socialmedia.php” which will be used by all posts of the type “socialmedia” as explained in the template hierarchy, and this file simply calls the 404.php file in my theme using the following code:
<?php /** * The Template for displaying all posts of the "socialmedia" type. * * - Loads the 404.php template * * @package WordPress * @subpackage Project Bee Racing * @since Project Bee Racing 1.0 */ ?> <?php get_template_part( '404' ) ?>
The end result is a post type that gives the illusion of having no permalink and is inaccessible on your site as an individual post. Perfect for creating item lists of an unknown quantity / value social as social media links.
– Jack
Forum: Fixing WordPress
In reply to: Create Custom Posttype with no permalinkHi Ipstenu,
Thanks for your hasty reply, as you’ve said Menu’s are technically just custom post types, along with attachments, and a few others, and while I didn’t think there were Permalink’s associated with each of these types, after having a snoop around in the database they all have a guid set, however after trying to follow the links in the database for Menu items for example, it returns the default 404 template.
After looking into this a little further I suspect the 301 redirects may indeed be the best alternative after all, just with some added code to hide the Permalink display on the edit post page.
I’m going to continue to have a play around, and will post back any findings here for anyone that’s interested.
Any further advice is still appreciated.
– Jack