get custom image size

If you know the image’s ID : wp_get_attachment_image( $image->ID, array(200, 112) ); returns an HTML img element or empty string on failure. The entire code could be something like : <a href=”https://wordpress.stackexchange.com/questions/170690/<?= get_attachment_link(“5435′ ); ?>”> <?= wp_get_attachment_image( ‘5435’, array(200, 112) ); ?> </a>

Load content in a div with ajax

Use Ajax API provided by WordPress. In first time, fix your Ajax request : <script> $(“.post-link”).click(function(){ var post_id = $(this).attr(“rel”); //this is the post id $(“#post-container”).html(“content loading”); $.ajax({ url: myapiurl.ajax_url, type: ‘post|get|put’, data: { action: ‘my_php_function_name’, post_id: post_id }, success: function(data) { // What I have to do… }, fail: { // What I have … Read more

Is 30 posts/sec considered slow for wp_delete_post?

Speed factor of any function that deals with content such as wp_insert_post() or wp_delete_post() highly depends on the situation and the content that it’s dealing with. Let’s make a simple example. You have a post, that contains featured image, dozen of tags, categories, a thousand custom fields, assigned taxonomies, and a hundred more. When you … Read more

Show ‘Read more’ in rss feed

You can, but you shouldn’t. RSS feeds are built in XML. Not in HTML. Links in XML don’t have meaning because they’re HTML elements. However, because XML can be read by most HTML parsers (i.e. web browsers), you can easily mistake an XML document for an HTML one (the prevalence of XHTML helps to blur … Read more

Getting post id from wp_insert_post_data function?

In the following, ’10’ is the priority that my_func gets called and ‘2’ is the number of arguments that my_func accepts. The latter is important, since the add_filter function defines the default as 1, but the wp_insert_post_data filter hook sends two arguments. If you don’t set this as 2 you won’t get the second argument. … Read more