Creating a WordPress shortcode

Separate out your logic from the string you want to return: <?php // Adding a shortcode to return each author’s social media links function funcauthor_social( $atts ){ $meta_socialgr = esc_url(get_post_meta( $post->ID, ‘author_goodreads’, true )); $output=”<div class=”authorsocial”><h5>Connect, Share &amp; Follow</h5><ul>”; if (!empty($meta_socialgr)) { $output .= ‘<li><a href=”‘.$meta_socialgr.'”><img src=”http://fiddlehead.milkbossindustries.com/files/goodreads.jpg”></a></li>’; } $output .= ‘</ul></div>’; return $output; } add_shortcode( … Read more

Edit format of Paginate_Links()

There is no clean way to do this (that I notice from quick look at rather messy code of it), but $n_display is passed though formatting number_format_i18n() function which does have a filter. So you could try something like: function make_number_into_dot( $number ) { return ‘o’; } add_filter( ‘number_format_i18n’, ‘make_number_into_dot’ ); // your pagination handling … Read more

How do I create comment-reply-button using element not

You can generate a custom comment reply element like so: This will replace the **** HERE <SPAN> ELEMENT FOR REPLY-BUTTON WILL BE PLACED ****. <?php if ( get_option( ‘comment_registration’ ) && ! is_user_logged_in() ) : ?> <a rel=”nofollow” class=”comment-reply-login” href=”https://wordpress.stackexchange.com/questions/321913/<?php // wrapped echo esc_url( wp_login_url( get_permalink() ) ); ?>”>Log in to Reply</a> <?php else : … Read more

OOP Plugin Development. Including external object

The root of your problem is not object oriented programming, but a fundamental misunderstanding about how PHP handles requests. If this were a Java or a Node application for example, you would start the application on the server, and it would recieve requests, and respond. It’s a continuous active program. As a result, you can … Read more