Adding ads code between comments

The end-callback of wp_list_comments() One way is to use the end-callback argument in: wp_list_comments( [ ‘end-callback’ => ‘wpse_comments_ads_injection’, … other arguments … ], $comments ); in addtion to your other wp_list_comments arguments, by defining: function wpse_comments_ads_injection( $comment, $args, $depth ) { static $instance = 0; $tag = ( ‘div’ == $args[‘style’] ) ? ‘div’ : … Read more

get_users(…) only returns one user

The include key on get_users requires an array of IDs (numbers). You are giving it an array of objects that have an ID property. If you look at your first var dump you will see this. WP is casting that to a number and returning the user with that number which is not what you … Read more

Display user role Name – not slug

WordPress does not (currently) have a global function (e.g. get_role_name()) for getting the role name (e.g. Shop Manager for shop-manager or maybe shop_manager etc.), but you can easily get (and then display) it like so: $role=”shop-manager”; // the role slug; it’s up to you how to get the value.. $role_name = $role ? wp_roles()->get_names()[ $role … Read more

How do I display the function the_content in this loop?

try this instead: … global $post; while ($q_query->have_posts()){ $q_query->the_post(); $loophtml .= “<li><span class=”list-question-title”>” . “<a class=”list-answer-link” href=”” . get_permalink() .””>” . get_the_title() . “</a></span>”; $loophtml .= get_the_content(); $loophtml .= “<span class=”list-number-answers”>” . get_comments_number() . ” comentarios</span>&nbsp;&#183;&nbsp<a href=”” . get_permalink() .””>Comentar</a>”; $loophtml .= “</li>”; } wp_reset_query(); …

Use WordPress’ URL rewrite engine

I suggest you don’t try to take out the WP_Rewrite class and re-use it in your application, but look at other frameworks instead. Many MVC frameworks have nice rewrite engines, that not only offer more flexibility in handling incoming URLs, but also generating internal links according to these formats. The WordPress rewrite system is tightly … Read more

How to create another version of my site based on the same database

There are a couple of ways you can achieve what you asked for but the latter is what I’d recommend: Set up a copy of the site in a different directory and using your web host’s control panel map the different domains to the appropriate directories. Use the same DB_NAME/DB_USER/DB_PASSWORD/DB_HOST in the /wp-config.php file for … Read more

wordpress upgrade has broken my permalinks

Here are some steps for you a) Access you site through ftp and remove .htaccess file (possibly backup it) b) Go to admin of your site (wordpress admin) and open permalink settings form c) set the first option to custom and put the value in text box /%category%/%postname% d) save changes and check you front-end … Read more