Add user settings to specific roles

On the profile page exists a global variable $profileuser. The member $profileuser->roles is an array of all roles for that user. <?php # -*- coding: utf-8 -*- // Plugin Name: personal_options add_action( ‘personal_options’, ‘print_user_roles’); function print_user_roles() { global $profileuser; print ‘<pre>$profileuser->roles=” . htmlspecialchars( var_export( $profileuser->roles, TRUE ), ENT_QUOTES, “utf-8’, FALSE ) . ‘</pre>’; } Output: … Read more

Get all children page ID’s including parent by title

You have done this the hard way. WP_Query can do most of the work for you. function get_all_pages($page_title) { $page = get_page_by_title($page_title); if (empty($page)) return array(); $children = new WP_Query( array( ‘post_type’ => ‘page’, ‘post_parent’ => $page->ID, ‘fields’ => ‘ids’ ) ); array_unshift($children->posts,”{$page->ID}”); return $children->posts; } $allpages = get_all_pages(‘Sample Page’); var_dump($allpages); It is late, and … Read more

If Specific Post, Link Elsewhere

The reason why your check didn’t work is because is_singular() checks for post types, not for post IDs. is_singular( ‘product’ ) checks if the current post is of the type product, nothing else. The comparison 2295 === get_the_ID() does exactly what you need.

Conditional for 404 page not work

You should wrap your enqueue/register function in your conditional, not your add_action() You can try something like this using the is_404() conditional check function enqueue_404_script() { if(is_404()) { //do what you need to do } } add_action( ‘wp_enqueue_scripts’, ‘enqueue_404_script’ );

How to Add Javascript Only When a Function Exists?

Hi @Denis Belousov: Okay, based on your responses I’m going to ask why tie it to the function existing, why not just test the return value of get_option(‘src_switcher’) like this? function my_scripts() { if (!is_admin()) { wp_enqueue_script(‘jquery’); wp_enqueue_script( ‘custom’, get_bloginfo(‘template_directory’).’/js/custom.js’, array( ‘jquery’ ), ”, true ); if (is_front_page()) { $sliders = get_option(‘src_switcher’); if ($sliders == … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)