Array for WordPress Avatar Size and Class
Try this <?php if ($args[‘avatar_size’] != 0) echo get_avatar($comment,’70’,$default, $alt,array(‘class’=>array(‘media-object’,’thumbnail’))); ?>
Try this <?php if ($args[‘avatar_size’] != 0) echo get_avatar($comment,’70’,$default, $alt,array(‘class’=>array(‘media-object’,’thumbnail’))); ?>
I can’t comment due to lack of reputation, so I’ll address the issue rudtek mentioned. Personally, I never came across a host that disables PHP’s rand() function, but in case there is such a lousy host, you can opt for a more efficient way of doing things. What you can do is to get all … Read more
WordPress Settings API Overrides My Previous Value
That is not an accepted SQL syntax per the MySQL manual. You must INSERT INTO MyGuests (firstname, lastname, email) VALUES (‘John’, ‘Doe’, ‘[email protected]’) But, and this is an expansion well beyond the scope of your question, if you have an array of this information, you could iterate over the whole thing to build your SQL … Read more
If we look at the official documentation, this is how wp_set_object_terms is used: wp_set_object_terms( int $object_id, string|int|array $terms, string $taxonomy, bool $append = false ) Notice the final parameter that isn’t being used in your code, it has a default value of false: bool $append = false ) So everytime your loop runs, it wipes … Read more
to get pages as array use get_pages() instead. now once we have a list we can check the size of list and split it. Let’s have an example: $allpages = get_pages( array( ‘child_of’ => $section_top_parent, ‘post_type’ => ‘section’, ‘depth’ => 1, ‘sort_order’ => ‘asc’ ) ); //check $allpages has any value if($allpages){ //calculate the array … Read more
You need to do the slice on the results, not the arguments to the function. So: $arr = array( //$section_top_parent is the top parent of the custom post type “section” ‘child_of’ => $section_top_parent, ‘post_type’ => ‘section’, ‘title_li’ => NULL, ‘depth’ => 1, ‘sort_order’ => ‘asc’, ); $result = wp_list_pages($arr); $sliced = array_slice($result, 3, 5); wp_list_pages($sliced);
The docs show that you can do paging with page and per_page, so looks like you should be able to set per_page to 1 and leave page unset to get a single result. i.e.: ./wp/v2/users/?_fields=id&orderby=id&order=desc&per_page=1 Does that help?
I added the capabilities now through this code. I’m not happy with my solution and it would be great if someone could find a proper way to add to the filter. I would be honestly interested to know how to make it properly work. add_action( ‘admin_init’, ‘jp_add_atum_caps_to_shop_manager’); function jp_add_atum_caps_to_shop_manager() { if(!user_can( 217 , ‘atum_read_inbound_stock’)) { … Read more
I am new here and I think @mozboz is correct on where to ask this question, but you have could loop through the array and explode the keys and use the last value to create the array you want.