How to add child page to author.php
How to add child page to author.php
How to add child page to author.php
current_user_can does not give the desired output when working with roles. There is a trac ticket #22624 explaining this all. It was closed with the following Keywords close removed Milestone Awaiting Review deleted Resolution set to wontfix Status changed from new to closed My solution would be to get the role of the featured user … Read more
As per the given url http….url…/author/name?MediaTag=tag1, below code may helpful… if(isset($_GET[‘MediaTag’])) //It will check the value of MediaTag (from address bar after ?) { $tag1 = $_GET[‘MediaTag’]; //Assigning value of MediaTag to the variable if($tag1) //Checking if variable have some value or not { query_posts(‘cat=1&author=” . $post->post_author . “&order=DESC&tag=’ . $tag1 .’&posts_per_page=12′ . ‘&paged=’ . … Read more
Could be because you are passing an array of array try this: <?php $my_query = new WP_Query(); $my_query->query(array( ‘post__in’ => $curauth->user_favourite_post)); while ($my_query->have_posts()) : $my_query->the_post(); ?> <h3><a href=”https://wordpress.stackexchange.com/questions/27808/<?php the_permalink(); ?>”><?php the_title(); ?></a></h3> <?php endwhile; ?>
You’ve already used sanitize_title once in you code. You need to use that in again, inside the wpse5742_author_link function. $link = str_replace( $author_nicename, sanitize_title($author_nickname), $link ); That should take care of the spaces. Another other option is to use urlencode but sanitize_title keeps things consistent. I (minimally) tested your code with that change and it … Read more
You can riff off of how WooCommerce and other plugins are providing templates in their plugin, while allowing the theme to override them if they exist. Basically, you hook into the template_include function, which is where WordPress decides what template to load for a given query. Since you want to do something with the author.php … Read more
Use pre_get_posts to modify author archive queries- function wpd_author_archive( $query ){ if ( $query->is_author() && $query->is_main_query() ){ $query->set( ‘post_type’, array( ‘post’, ‘product’ ) ); } } add_action( ‘pre_get_posts’, ‘wpd_author_archive’ );
You can use the get_queried_object where the CODEX says: if you’re on an author archive, it will return the author object So since you have an object, you can return it values: $author = get_queried_object(); echo $author->first_name . ‘ ‘ . $author->last_name; And you can use the same parameters as get_the_author_meta(): user_login user_pass user_nicename user_email … Read more
Try with WP_Comment_Query and make sure you have the right Author ID from the Author Template. // WP_Comment_Query arguments $args = array ( ‘user_id’ => $user->ID, ‘post_status’ => ‘approve’, ‘number’ => ’10’, ); // The Comment Query $comments = new WP_Comment_Query; $comments = $comments->query( $args ); // The Comment Loop if ( $comments ) { … Read more
This is a very simple PHP issue, unrelated to WordPress. You need to check if the value is empty before echoing it. So, store them as variables first: $twitter = get_the_author_meta(‘twitter’, $author_id); $facebook = get_the_author_meta(‘facebook’, $author_id); //etc Then check them before displaying: if(!empty($twitter)) { echo ‘<a title=”Follow me on Twitter” href=”‘.$twitter.'”><img src=”twitter.png” alt=”” /></a>’; } … Read more