Alan Niemies
Forum Replies Created
-
Hello, Tobias.
I found it strange, too, as I recall testing these a few weeks ago, still using TablePress, without all this huge time.
I’m going to try it again. I don’t think ‘m using JavaScript or maybe in one or another post and this is not essential, so I’m going to remove it from loading.
Thanks a lot!
Sincerely,
AlanForum: Hacks
In reply to: Custom Post Type with no slug in permalink return 404 for Child postsMaybe I need to create a rewrite URL along with these pieces of code?
This is what Milo added as a comment in a similar Stack Exchange post (http://wordpress.stackexchange.com/questions/83531/custom-post-type-404s-with-rewriting-even-after-resetting-permalinks):
“Filtering ‘post_type_link’ is simply changing the URLs WordPress generates when it outputs a permalink for your post type. When you visit one of those URLs, WordPress doesn’t know what to do with them or what they’re supposed to point to, as you haven’t done anything to generate rewrite rules for incoming requests. Without knowing what format you want for your links, it’s not possible to give an answer beyond pointing you to add_rewrite_rule and add_rewrite_tag.”
Forum: Hacks
In reply to: Custom Post Type with no slug in permalink return 404 for Child postsHi @bcworkz. Thanks for these information.
As I’m stepping into unknown territory, it’s being hard to understand pre_get_posts.
Right now, I am willing to simplify these conditional tags as much as possible as I am not using Posts in my website anymore and shouldn’t be using for a long time.
All I need are pages to work when they are queried for. And for the Custom Post Type “artigos”, I need them to show within category/tag pages as well as in single for this CPT, with the correct slug.
With this setup, I THINK it would even be possible to modify the main query as well? Does this makes sense or help you guys to help me?
Anyway, I’m still trying multiple inputs and if I get something, I will update you.
Thanks again for your help!
Forum: Hacks
In reply to: Custom Post Type with no slug in permalink return 404 for Child postsAn update: both the child and parent page page are now working with the /artigos slug or without it:
– mysite.com/parent-page/
– mysite.com/artigos/parent-page/
– mysite.com/artigos/parent-page/child-page
– mysite.com/child-pageAll working, except the desired config: mysite.com/parent-page/child-page, which still returns a 404
Strange, right?
- This reply was modified 9 years, 5 months ago by Alan Niemies.
- This reply was modified 9 years, 5 months ago by Alan Niemies.
Forum: Hacks
In reply to: Custom Post Type with no slug in permalink return 404 for Child postsHello @wppatrickk
Thanks for the above input. I still can’t manage to make it work. I keep getting the 404 in child page. 🙁
Full code is now this:
/* Add custom_post_type Artigos */ add_action( 'init', 'create_artigos_post_type' ); function create_artigos_post_type() { register_post_type( 'artigos', array( 'labels' => array( 'name' => __( 'Artigos' ), 'singular_name' => __( 'Artigo' ), 'add_new' => __( 'Adicionar novo' ), 'add_new_item' => __( 'Adicionar novo Artigo '), 'new_item' => __( 'Novo Artigo' ), 'edit_item' => __( 'Editar Artigo' ), 'view_item' => __( 'Ver Artigo' ), 'all_items' => __( 'Todos os Artigos' ), 'search_items' => __( 'Pesquisar Artigos' ), 'parent_item_colon' => __( 'Artigo pai' ), 'not_found' => __( 'Nenhum Artigo encontrado' ), 'not_found_in_trash' => __( 'Nenhum Artigo encontrado na lixeira' ), ), 'public' => true, 'has_archive' => true, 'hierarchical' => true, 'menu_position' => '5', 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'comments', 'custom-fields', 'revisions', 'page-attributes' ), 'taxonomies' => array( 'category', 'post_tag'), 'capability_type' => 'post', 'with_front' => false, ) ); } /* Remove Slug from custom_post_type Artigos */ function na_remove_slug( $post_link, $post, $leavename ) { if ( 'artigos' != $post->post_type || 'publish' != $post->post_status ) { return $post_link; } $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link ); return $post_link; } add_filter( 'post_type_link', 'na_remove_slug', 10, 3 ); function na_parse_request( $query ) { if ( ! $query->is_main_query() || 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) { return; } if ( ! empty( $query->query['name'] ) ) { $query->set( 'post_type', array( 'post', 'artigos', 'page' ) ); } } add_action( 'pre_get_posts', 'na_parse_request' );Forum: Hacks
In reply to: Changing default ‘posts’ hierarchy parameter with register_post_type_argsThanks a lot for your resourceful input! I ended up creating the new Custom Post Type and moving all my posts to it, as you stated at the end of your answer, as I think this is better than trying to change a core post type.
All the transition was seamless. After creating my custom post type I used Convert Post Types plugin to move all the posts to there. Had to change some details in my custom queries in homepage but now everything is working as expected, with the added hierarchical capability.
Thanks a lot again for your invaluable help! You’re awesome. 🙂
Forum: Plugins
In reply to: [W3 Total Cache] Parse error after upgrade to 0.9.5I’m having the same problem when I tried to activate the plugin after some sensitive changes in my template files.
Forum: Plugins
In reply to: [Theme My Login] Lost Password page shows login formHello, Jeff.
Thanks for the reply. I can’t edit this page as it isn’t in the list of pages under WP Admin. So, how can I see/change this meta value?
Thanks for your time.
Forum: Fixing WordPress
In reply to: WordPress 301 not working (maybe related to SSL?)Any insights on this subject?
Forum: Plugins
In reply to: [Secure Invites] Registration link does not turn freely registrationHow did you solve the problem, brave73? I’m having the same issue here, using BuddyPress with a /register page for Registration.
Thanks.Forum: Fixing WordPress
In reply to: Why am I getting this when I try to log into my siteHello, xinak.
I don’t know if you still need this, but I was getting this error on a client’s website and managed to correct it. For me, the issue was with a cache plugin (W3 Total Cache). You have to disable login and other pages from caching.
For W3 Total Cache, go to Performance > Page Cache. Find the section called “Never cache the following pages:” and add these entries, one per line:
/login/
/register/
/transactions/
/payments/
/download/
/lostpassword/
/subscribe/That should make Magic Members compatible to your website. Hope it helps you or future users. 🙂
The page for publishing new articles is in http://medsimples.com/publicar/. If you manage to registrate with Facebook you may take a look.