Custom post type specific item design

I think there are many ways to do so. Here is a simple solution for the loop-template: <?php // set css class, if post-title is ‘diamond’ $cpt_class = (‘diamond’ === strtolower( $post->post_title ) ) ? ‘post-is-diamond’ : ”; ?> <!– Begin loop-template –> <article <?php post_class( $cpt_class ); ?> id=”post-<?php the_ID(); ?>”> … your stuff … Read more

Display a custom name when the user has no name settle in his account

Use PHP ternary comparsion operator to check if get_user_meta() function returns blank or non-blank result: function colaborador_nome($atts) { if (is_user_logged_in() && !is_feed()) { return ‘&nbsp;’. (get_user_meta( get_current_user_id(), ‘first_name’, true ) ?: “Hi >No Name<, please settle your name in your account.”); } } add_shortcode(‘colaborador_nome’, ‘colaborador_nome’);

Rename a folder via HTML POST request

In order to rename you have to alter your code like bellow. You code was missing absolute path of the directory. That’s why your code was not working. Adding ABSPATH will fix the code. rename( ABSPATH . “wp-content/uploads/Directory/Clients/$Client_Name”, ABSPATH . “wp-content/uploads/Directory/Clients/$New_Name” ); Why not you use WP_Filesystem_Direct. It’s better and fatal-safe. You can easily use … Read more

Redirection from a specific page for users logged in but not with membership

Your code is fine to me, except you made a mistake here: template_redirect(‘/product/channel-mcgilchrist’); WordPress does not have a function named template_redirect, only a hook with that name. So you should have used either wp_redirect() or wp_safe_redirect() which are valid functions to perform URL/page redirections in WordPress. wp_safe_redirect( ‘/product/channel-mcgilchrist’ );