How to reorder the content of the single post?

try this in functions.php function author_after_content($content) { if ( is_singular(‘post’) ) { $content .= “<p>بقلم : ” . the_author() . “</p>”; } return $content; } add_filter(‘the_content’, ‘author_after_content’, 20);

redirect “about author” code to about page

Use get_userdata() to retrieve all user data. The function accepts user ID. So the following code will give you the user url. <?php php $user_info = get_userdata(1); /* replace 1 with dynamic user id variable in your context*/ echo ‘User url: ‘ . $user_info->user_url . “\n”; echo ‘Users name: ‘ . $user_info->first_name . “\n”; ?>

Get x recent posts by author?

The function you are using, get_most_recent_post_of_user, won’t work as it only retrieves the latest post from the author. It cannot retieve a list of posts Walks through each of a user’s blogs to find the post with the most recent post_date_gmt. You will most probably be better of using either WP_Query or get_posts to achieve … Read more

Find custom post type url by author

Query for post type listing_type and author ID within your loop: $args = array( ‘post_type’ => ‘listing_type’, ‘author’ => get_the_author_meta( ‘ID’ ) ); $listing_post = new WP_Query( $args ); if( $listing_post->have_posts() ){ while( $listing_post->have_posts() ){ $listing_post->the_post(); the_permalink(); } } // reset $post global to original value wp_reset_postdata();

How can I set a maximum allowed post size and number of posts submitted?

The best way I know of would be to filter the data. For posts, you might do: function my_check_post_not_crazy( $data, $post_arr ) { $max_content_length = 2048; # max length in characters $max_num_posts = 200; # maximum number of posts if ( !current_user_can(‘activate_plugins’) && empty( $post_arr[‘ID’] ) ) { $die_args = array(‘back_link’ => true); # Not … Read more

Authors divided alphabetically

This is what I ended up with. Totally does the trick, minus the sorting by last name. Would love to hear any additional thoughts on that. $display_admins = false; $order_by = ‘display_name’; // ‘nicename’, ’email’, ‘url’, ‘registered’, ‘display_name’, or ‘post_count’ $role=””; // ‘subscriber’, ‘contributor’, ‘editor’, ‘author’ – leave blank for ‘all’ $avatar_size = 32; $hide_empty … Read more

Display Authors avatars when more than one author

Here we go, found a nice thread which gave some answers and developed this which works a treat: if ( class_exists( ‘coauthors_plus’ ) ) { $co_authors = get_coauthors(); foreach ( $co_authors as $key => $co_author ) { $co_author_classes = array( ‘co-author-wrap’, ‘co-author-number-‘ . ( $key + 1 ), ); echo ‘<div class=”‘ . implode( ‘ … Read more

Change author permalink to external URL

You can override the author link via the author_link filter: function wpd_author_link( $link, $author_id, $author_nicename ){ return ‘http://my.blog.tld/’; } add_filter( ‘author_link’, ‘wpd_author_link’, 20, 3 ); $author_id and $author_nicename are available to the filter so you can fetch whatever data you need to generate the correct link.

ACF Relationship – Exclude pages not created by author

If you want to exclude ALL pages that doese’t have ‘collaborator’ set as author, then you want to exclude all other pages in the site and include all pages of that author minus, maybe, some hand picked pages of that author, then I think you can use this: add_filter(‘acf/fields/relationship/query/name=products’, ‘exclude_id’, 10, 3); function exclude_id ( … Read more

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