Tag Info

Hot answers tagged

3

<?php class someClass { public function __construct($options = null, $initialize = true, $error_messages = null, $path, $qnty) { //construct what you see fit here.... } //etc.. } // Action listener add_action( 'action_name', create_function('', "new someClass(implode(',',func_get_args()));"), 10, 5 // IMPORTANT, ...


2

You can not execute functions inside the do_shortcode() call like you are trying to. If you are just trying to wrap your post meta content with the shortcode, then you can do it like shown below. $your_post_meta_variable_content = get_post_meta( $postid, principal_1, true ); echo do_shortcode( '[learn_more caption="ancila"]' . ...


1

Another safer alternative to this problem is using get_queried_object() which holds the current queried object to get the page slug which is held by the post_name property. This can be used anywhere in your template. $post can be used, but it can be unreliable as any custom query or custom code can change the value of $post, so it should be avoided outside ...


1

You can use page id as mentioned by @vee s answer. For Eg: If you want to echo Hello world on front page, page id 1, and 2 with echo Else world for all other pages, use: <?php if ( ( is_front_page() ) && ( is_page(1) || is_page(2) ) ) { echo "Hello World"; } else { echo "Else world"; ?> For more info: ...


1

Are you creating your users via regular means or somehow importing them? Trying to create such user WP prevents me from doing so: ERROR: This username is invalid because it uses illegal characters. Please enter a valid username. The reason for that is that username is validated with validate_username(), which runs sanitize_user() in strict mode. That ...


1

I solved the issue. Basically, in my code I was storing the data after getting the html, so I just moved the storing code above where I get the html and it worked ..


1

There are two issues with what your form is currently trying to do: action="page-rebrander.php" is meaningless to WP (if you actually do have such custom file β€” you shouldn't). In WP mechanics you should be typically submitting form to the page itself, options.php (for Settings API), or admin-post.php (for more generic forms). You are trying to pass data ...


1

You can try this out : <?php global $my_profile; ?> <?php if (is_user_logged_in()){ $avatar = '<div class="img" data-key="profile">'.get_avatar( get_current_user_id(), 64 ).'</div>'; }else{ $avatar = ''; } ?> And your menu code should be like this $defaults = array( 'theme_location' => 'location of menu in ...


1

Use wp_nav_menu_items add_filter('wp_nav_menu_items','wpsites_add_avatar_to_nav', 10, 2); function wpsites_add_avatar_to_nav( $items, $args ) { if( $args->theme_location == 'primary' ) return $items; $dude = get_avatar( get_current_user_id(), 48 ); if (is_user_logged_in()) : echo'<li class="your-custom-class right">' . ...



Only top voted, non community-wiki answers of a minimum length are eligible