Enrique J. Ros
Forum Replies Created
-
Forum: Reviews
In reply to: [Weight zone shipping for WooCommerce] Almost perfect :)Yes, a percentage of the cost of the items (so it can be used to provide customs taxes). Actually I could do it (as I said it’s easy, just a pair of lines of code). I meant to say that it’d be great to include it as a setting, would be useful for the people who can’t code.
Solved at last!
Finally Ben provided the solution, using this filter:
add_filter('kadence_sidebar_id', 'custompost_sidebar_id'); function custompost_sidebar_id($sidebar) { if(is_singular( 'custom-post-type' )) { $sidebar = 'sidebar-primary'; } return $sidebar; }
Many thanks Ben and Hannah for your valuable help!
- This reply was modified 7 years, 11 months ago by Enrique J. Ros.
Completely sure. I have just done a pair of tests:
* I created a new different cpt by using a code from generatewp, switched a post to cpt, and no sidebar
* I made a clean install of WordPress in a local server (until now I’ve been using a VPS), with no plugins. I’ve installed a Genesis child theme and Virtue Premium, created a cpt and, again, switched a post to cpt. No issues with Twenty Sixteen or Genesis. No sidebar with Virtue Premium.
Enrique
No, its not. As I said, with any other theme the sidebar works perfectly, is Virtue the only one with the issue.
Sorry, I misunderstood you ??
If I create a new custom post from scratch, even if I do it by copying the title and content from a post (the cpt has no taxonomies) it shows the sidebar perfectly, but if I switch the post type from post to relatos (that’s the name of the cpt) the sidebar is empty. I’ve tried to do it with two different plugins (Post Type Switcher, one by one and in bulk mode, and Post Type Convertr) and going to the database and manually changing the value of post_type from “post” to “relatos”, and it always leads to the same: empty sidebar.
All existing sidebars (my client created a custom one via the theme options) have content in. If you want I can give you access, since it’s a copy of the site in my staging server.
Many thanks again.
Converting published posts to a diferent custom post type.
Thanks for your patience, Ben, and sorry if I can’t explain the problem properly because of my poor English.
I realized that the cpt shows the sidebar properly if it’s created as the cpt, but if I switch an existing regular post to cpt, the sidebar shown is empty (no widgets are shown). If I switch the theme, everything’s ok again.
Thanks again.
Here again ??
Is the Kadence adding any meta key to postmeta (or any other table in the database) that may be causing that? I still need to convert those post to cpt and the problem is not caused by the plugin, but by the conversion itself (no matter the way it’s done).
Regards.
- This reply was modified 7 years, 12 months ago by Enrique J. Ros.
Hi Ben
After doing lots of tests, I realized that it was caused by a plugin used to switch previously published posts to the new cpt (Post Type Switcher). For some reason, after using the plugin to switch the post type, the cpt no longer shows the sidebar (although it does with other themes).
I don’t know the exact cause yet, but I don’t think I get to ever know it: I’ll just look for an alternate way to switch the post type ?? I want to thank you and Hannah very much for your valuable help and your patience.
Many thanks. Best regards.
No, I don’t want to change the layout for single posts. Ok, let’s start from the very beginning.
I did a custom post type, and it’s showing an empty sidebar in the is_singular view, as you can see here: https://espacioulises.tk/relatos/ulises-en-el-festival-de-cannes-relato-vidas-de-cine-de-patxi-hinojosa-lujan/
I just want your theme to display there the same sidebar shown in single posts.
Enrique
Hi Ben
Thanks for your kind help, but that didn’t work. I changed the code to:
add_filter('kadence_display_sidebar', 'custompost_sidebar'); function custompost_sidebar($sidebar) { if (is_singular('post')) { return false; } return $sidebar; }
And regular posts changed to a full-width layout, so I guess the hook kadence_display_sidebar sets the layout. But, as Hannah noticed, the sidebar is there in is_singular(‘my-cpt’), so the layout is content-sidebar, but it’s empty: https://espacioulises.tk/relatos/ulises-en-el-festival-de-cannes-relato-vidas-de-cine-de-patxi-hinojosa-lujan/
If it helps, $sidebar is getting a ‘1’ (I think that means the layout is set as content-sidebar)
Many thanks again. Best regards
Enrique- This reply was modified 8 years ago by Enrique J. Ros.
- This reply was modified 8 years ago by Enrique J. Ros.
Hi Ben, thanks for your response
I don’t have access to the premium support forums, I didn’t buy the theme, my client did (I can tell you the activation key by email if necessary).
I just want my cpt to show the same sidebar as the regular posts do in is_singular
Thanks again. Best regards.
Enrique- This reply was modified 8 years ago by Enrique J. Ros.
- This reply was modified 8 years ago by Enrique J. Ros.
Hi Hannah
Now I see what the problem is. The theme enables those options via custom fields, so they only appear in the post types created by the theme. Is there a hook I can use in the API of the framework to enable those options in my cpt? perhaps by using add_post_type_support?Many thanks again
Enrique- This reply was modified 8 years ago by Enrique J. Ros.
Many thanks again, Hannah
That may be the problem, I haven’t done anything special to enable a sidebar with the cpt page. I’ve search in the options of the theme but didn’t find anything. There are two sidebars with widgets inside but, how should I enable a sidebar to be shown in that content page?Hi Hannah
Thanks for your kind response. No, I’m not using a child theme, it’s a staging server and I not going to do any changes in the theme (I added those templates just trying, but actually shouldn’t be necessary, I already removed them).The source code shows the sidebar section, but it’s empty. If I switch the theme to TwentyTwelve, the sidebar is shown correctly.
Link to site: https://espacioulises.tk/
CPT archive: https://espacioulises.tk/relatos/
Single CPT: https://espacioulises.tk/relatos/ulises-en-el-festival-de-cannes-relato-vidas-de-cine-de-patxi-hinojosa-lujan/
Single regular post: https://espacioulises.tk/resena-putas-asesinas-de-roberto-bolano/Many thanks again
Enrique