Can I wrap an unordered list inside a shortcode?

You can capture the list in a variable, rather than echo it: $list=”<ul class=”strong”> <li>” . get_field( ‘highlights_list_item#1’ ) . ‘</li> <li>’ . get_field( ‘highlights_list_item#2’ ) . ‘</li> </ul>’; echo do_shortcode( ‘[one_half]’ . $list . ‘[/one_half]’ ); Note the use of get_field() rather than the_field(), which returns a custom field value as opposed to displaying … Read more

Change an li class name in a wordpress custom menu walker

Troubleshooting Enabling the WP_DEBUG constant in wp-config.php exposed the following errors: – Function Signatures If Strict Standards is enabled, you’ll see an error detailing incompatible method signatures. Though not absolutely necessary, I like to eliminate as many errors as possible. To correct this, the new Walker_Nav_Menu class’s start_el() and start_lvl() methods’ declarations need to match … Read more

How to convert custom post type based list to a dropdown list?

the_title() and the_permalink() are functions that automatically echoed. Use in this case get_the_title() and get_permalink(). the code should look something like this: while ( $query->have_posts($post->ID) ) : $query->the_post(); echo ‘<li><a href=”‘. get_permalink(). ‘”>’ .get_the_title() .'</a></li>’; endwhile; Here is another way using the_title and the_permalink: while ( $query->have_posts($post->ID) ) : $query->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/191514/<?php the_permalink(); ?>” … Read more

Exclude admin from user list

You could use user_can( $user_id, ‘manage_options’ ) to gauge the ids in the users array and unset($users->[$x]) the appropriate row. I would personally use $users = array(); foreach ($results as $user) if (!user_can( $user->ID, ‘manage_options’ )) $users[] = $user; But that’s just me.

List pages by custom field?

Function wp_list_pages() accepts arguments from get_pages() function. To list pages filtered by custom field use meta_key and meta_value in parameters array. A list of accepted parameters can be found here and here. wp_list_pages([ ‘meta_key’ => ‘your_meta_KEY’, ‘meta_value’ => ‘searched_value’, // optional ]); meta_value is not mandatory, if you skip it, a list of pages with … Read more

Remove Order List Row Link in WooCommerce Admin?

Based on class-wc-admin-list-table-orders.php (order column on line 173) there doesn’t seem to be a filter to change the markup. To circumvent this, perhaps you could add a js/jQuery script, to admin_footer or with admin_enqueue_scripts, which either adds the necessary class(es), removes href or changes it to #, or with some event delegation wizardry have your … Read more

Check child/parent categories if exists

You can get the current posts category outside the loop by using the get_the_category function. http://codex.wordpress.org/Function_Reference/get_the_category When you have the actual category ( however you got it) you can use get_categories, specifically the ‘child_of’ parameter and pass it the parent cat ID. http://codex.wordpress.org/Function_Reference/get_categories Also have a look at wp_list_catagories, http://codex.wordpress.org/Template_Tags/wp_list_categories#Display_or_Hide_the_List_Heading where you can do something … Read more

Displaying terms by first letter

Try this code. <?php $taxonomy = ‘authors’;// e.g. post_tag, category $param_type=”authors”; // e.g. tag__in, category__in $term_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ); $terms = get_terms($taxonomy,$term_args); if ($terms) { $first_letter = null; foreach( $terms as $term ) { $flag = 0; if( $first_letter != substr( $term->name, 0, 1 ) ) { $first_letter = substr( $term->name, … Read more

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