Showing user profile data on front-end

You are trying to access the meta data of the user with ID stored in $user->ID but the object $user is not defined in your code. You are also using an undefined variable $user_ID. The quickest fix in your code would be to change this: get_the_author_meta( ‘province’, $user->ID ) ) With: get_the_author_meta( ‘province’, $userdata->ID ) … Read more

Adding custom post formatting options in custom post types

maybe it’s too late, but I found out how to solve this so I think I could share my solution. You have to access the global $post variable to find out the post type: function haet_custom_toolbar( $initArray ) { global $post; $post_type = get_post_type( $post->ID ); if( ‘page’ == $post_type ){ $initArray[‘toolbar1’] = ‘formatselect,styleselect,|,bold,italic,|,alignleft,aligncenter,alignright,|,pastetext,removeformat,|,undo,redo,|,bullist,numlist,|,link,unlink,|,spellchecker,fullscreen’; $initArray[‘toolbar2’] … Read more

How do I register a new settings page? [closed]

you can try a code like this <?php function theme_settings_init(){ register_setting( ‘theme_settings’, ‘theme_settings’ ); } î This is used to reserve a name for a custom settings array //Add settings to page menu function add_settings_page() { add_menu_page( __( ‘Contenu éditable’ ), __( ‘Contenu éditable’ ), ‘manage_options’, ‘settings’, ‘theme_settings_page’); } î This will create the page … Read more

same user role or copy the user role to be same as the other role

Contributor has the following capabilities delete_posts edit_posts read You can create the “Seller” role to have same capabilities as Contributor add_role( ‘seller’, __( ‘Seller’ ), array( ‘read’ => true, ‘edit_posts’ => true, ‘delete_posts’ => true, ) ); Warning from codex NB: This setting is saved to the database (in table wp_options, field wp_user_roles), so it … Read more

video.js not enqueueing?

It could be a couple of things: video.js doesn’t exist at get_template_directory_uri().’/js/video.js’ WP isn’t recognizing modernizr as a registered script, so it won’t enqueue video-js A couple of things to try/research: Is there any plugin already registering a script named modernizr and/or video-js? Try registering (not enqueueing) modernizr within your lw_scripts_10 like so: function lw_scripts_10() … Read more

Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS

I wanted to achieve the same thing.. What I ended up doing was creating a function that collects the Kirki variables (see here about the use of variables in Kirki) and writes them to a scss.. $file = get_template_directory() . ‘/sass/custom/_custom_vars_mixins_options.scss’; if(file_exists($file)){ $output = “”; $variables = Kirki::get_variables(); foreach ( $variables as $variable => $vvalue … Read more

Show media-uploads to all users

The plugin you mentioned is only reportedly tested up to WordPress version 3.6.1. I would not (in general) recommend abandoned plugins, because they might impose security risks. Additionally it uses PHP4 class constructors, that might soon be deprecated and it calls non static methods in a static way. If you remove the plugin, you should … Read more

Getting out side of wp root folder from function.php using absolute path

If you want the absolute path to your theme’s stylesheet directory you could use get_stylesheet_directory(). If you want the URI of your theme’s stylesheet directory you could use get_stylesheet_directory_uri(). get_theme_root() will return the absolute path to the themes directory. get_home_path() will return the absolute filesystem path to the root of the WordPress installation. Once you’ve … Read more