PHP 5+ stream wrappers with the underlying WordPress File API?

I’ve been pointed at the GSoC project, but I haven’t explored its finer points, yet. (Looks like that will take a decent chunk of time.) Practically speaking, I tried to use WordPress with stream wrappers, and I immediately found that wp_mkdir_p() and the GD functions imagejpeg(), imagegif() and imagepng() were incompatible. I’ve submitted a patch … Read more

Why can I not use setup_postdata($post) in the sidebar?

Your function works in your page template but not in the sidebar because at the point that your template is processed, $post already contains the post that has been loaded for the page. I tried your code and, just like Michael said, all I needed to add was the global declaration of $post inside the … Read more

How to loop through JSON data in wordpress WP REST API

I managed to solve this and access the JSON data using a foreach loop: $json = lusso_posts(); #var_dump( $json ); #die(); foreach( $json as $post ) { $titles = $post->title; $images = $post->featured_image->guid; ?> <div class=”lusso-posts”> <div class=”image-container”><img src=”https://wordpress.stackexchange.com/questions/210472/<?php echo $images; ?>” /> </div> <h4><?php echo $titles; ?></h4> </div> <?php }

PHP XMLRPC for WordPress: Adding meta tags and description

The field for tags is mt_keywords, as reference see this ticket. The field for the category is categories. Important is it, that you have a array for the fields, like $categories[0] = “cat1”; $categories[1] = “cat2”; $tags[0] = “tag1”; $tags[1] = “tag2”; $content[ ‘categories’ ] = $categories; $content[ ‘mt_keywords’ ] = $tags; As reference for … Read more

Shortcode putting html such as

This behavior is most likely intended, and can be disabled. However it might break other features too. There are a couple of workarounds, that you can try. Break the Image URL and File Name You can pass the arguments to your shortcode in the following way: [theimg path=”https://s.w.org/about/images/logos/” filename=”wordpress-logo-simplified-rgb.png” ] This will prevent the editor … Read more

Build a content and excerpt grid loop with paging and options for # of posts

The $wp_query properties allow “alot” Actually it’s not that hard if you use parts of the $wp_query object like current_post. Here you can see some examples that make some tricky use of things like is_paged(), $wp_query->current_post and $wp_query->posts_per_page. You can switch MarkUp depending on if you’re on the first or later pages, if you got … Read more

Custom query to get post names beginning with a digit

The solution given by @RolandoMySQLDBA will give you all posts because you have a * and not a +. The * means to return zero or more matches, which is not what you want. In this case, you actually don’t need either, but just to match the first character. Try this: $sql .= $wpdb->prepare( ” … Read more