-
Author
Tagged: custom post-types. priority, functions
-
October 20, 2014 at 01:35 #32166chazzzzyParticipant
I use permissions to control what users can post, etc.. and i need to change your priority of your creation of Post Types in kleo//lib/post-types.php
You currently have them as:
COPY CODEadd_action( 'init', array( &$this, 'setup_clients_post_type' ), 100 ); add_action( 'init', array( &$this, 'setup_testimonials_post_type' ), 100 ); add_action( 'init', array( &$this, 'setup_portfolio_post_type' ), 100 );
I need to change them to 49
Problem is that you have not put a way for me to override the post-types actions in my child-theme.
Do you know how to do it without me having to change the actual parent files?
Normally you would put:
if ( function_exists( 'setup_clients_post_type ()' ) ) {......
in your actual parent template files, but you have not done that, so how can I override the priorities that you have set?
Thanks!
October 20, 2014 at 23:29 #32313sharmstrModeratorNormally you can remove the action, then readd the action with a different priority. http://stackoverflow.com/questions/12539947/how-can-i-change-action-priority-in-wordpress
They are public functions, so maybe something like this will work? (you might have to play with it since they are in a class)
remove_action( 'init', 'setup_clients_post_type', 100 ); remove_action( 'init', 'setup_testimonials_post_type', 100 ); remove_action( 'init', 'setup_portfolio_post_type', 100 ); add_action( 'init', 'setup_clients_post_type', 49 ); add_action( 'init', 'setup_testimonials_post_type', 49 ); add_action( 'init', 'setup_portfolio_post_type', 49 );
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
October 21, 2014 at 19:20 #32474chazzzzyParticipantNothing works.. I can’t even remove the custom pages. Any idea how I can just remove them? The remove_action does not work at all.. and I’ve tried so many variants from googling things around the net.
Thanks so much!
Charles
October 21, 2014 at 19:46 #32479AbeKeymasterHi chazzzzy,
This should work but you need to change a file that will be also included in next update. Add the code in your child theme.COPY CODEadd_action( 'after_setup_theme', 'kleo_my_remove_actions' ); function kleo_my_remove_actions() { global $kleo_post_types; remove_action('init', array( $kleo_post_types, 'setup_clients_post_type'), 100); }
And change this file content from your theme: wp-content/themes/kleo/lib/theme-functions.php with the content from the one attached
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.Attachments:
You must be logged in to view attached files.October 29, 2014 at 00:49 #33367AbeKeymasterGreat 😉
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
You must be logged in to reply to this topic.