Displaying logged in user name

The answer in your link is correct. If it’s just showing PHP code then your code isn’t between PHP tags <?php & ?>. <?php if (!is_user_logged_in()) :?> <a href=”https://wordpress.stackexchange.com/member-login/” class=”login”>Member Login</a> <?php else : ?> <a href=”http://wordpress.stackexchange.com/account-page/” class=”login”>Welcome <?php echo $current_user->display_name; ?></a> <?php endif; ?> <a href=”http://wordpress.stackexchange.com/membership/join-sccap-renew-membership/” class=”join”>Join</a>

WordPress trying to query two custom types to get child from the parent

So I was finally able to find what I needed: $loop2 = new WP_Query([ ‘post_type’ => ‘service’, ‘numberposts’ => -1, ‘meta_key’ => ‘_wpcf_belongs_service-category_id’, ‘toolset_relationships’ => [ ‘role’ => ‘child’, ‘related_to’ => $parent_id, ‘relationship’ => [‘service-category’, ‘service’] ] ]); https://wp-types.com/documentation/customizing-sites-using-php/displaying-child-posts/

number of posts with “Load More”

You can get the (current) displaying posts number from offset number. As it’s an ajax load more for wp post, it should has the offset numbers. So, you can display the number like this Javascript var offset = 4; return $.ajax({ url: ajaxurl, type: “POST”, data: data, success: function(returnData) { // diplay offset number in … Read more

Displaying child taxonomy before parent

My assumption here is that within your data structure you have only two level hierarchy: Countries are always top level parent terms (they never have their own parents), Streets are first level children, and each street only has one parent and no children. Do you need a list of all terms? In that case you … Read more

Limiting buddy press features based on membership level (PMPro)

Our docs are here: https://www.paidmembershipspro.com/add-ons/buddypress-integration/ When you edit a membership level, for the “unlock BuddyPress” settings, choose the “Yes – Give members access to specific features” option and it will show checkboxes for each BuddyPress module. This should work. Make sure the general settings for non-members are locking down everything.

Customizing the output of the archive and category widget without altering the original behavior of the widget

No, there are no filters for doing this. You would need to create your own version of the widgets in order to achieve this. You can find the default WordPress widgets in the following folder: /wp-includes/widgets in your WordPress installation. Simply copy the code from within the respective widget .php files in to your theme … Read more

Let user select the number of posts shown per page jquery error

A simple fix would be to change the query name; i.e. from page to pageVal. <script> jQuery(document).ready(function( $ ) { $(‘.page-select’).change(function(){ var checkIndex = ( window.location.href || ” ).indexOf(‘?’); if( checkIndex > -1 ){ var Link = window.location.href.substr(0, checkIndex-1); $(location).attr(‘href’, Link+’?pageVal=”+$(“.page-select’).val()); } else { $(location).attr(‘href’, window.location.href+’?pageVal=”+$(“.page-select’).val()); } }); }); </script> But I’d use this..: <script> … Read more

wordpress all post filter by year

<select name=”archive-dropdown” onchange=”document.location.href=this.options[this.selectedIndex].value;”> <option value=””><?php echo esc_attr( __( ‘Select Year’ ) ); ?></option> <?php wp_get_archives( array( ‘type’ => ‘yearly’, ‘format’ => ‘option’, ‘show_post_count’ => 1 ) ); ?> </select> This code may help you.

how to print total post count with 2 custom fields (date-range)

If you save the return of query_post(…) as a variable, and then run $var->found_posts, does that give you the expected result? Like so: $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $today = date(‘Y-m-d’, strtotime(‘-1 hours’)); $query = query_posts(array( ‘post_type’ => ‘post’, ‘paged’ => $paged, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘meta_query’=>array( ‘relation’=>’AND’, array( … Read more