Add custom Attachment Display Setting for images

This will add a field in the attachment edit screen for applying a class to the img tag. function IMGattachment_fields($form_fields, $post) { $form_fields[“imageClass”][“label”] = __(“Image Class”); $form_fields[“imageClass”][“value”] = get_post_meta($post->ID, “_imageClass”, true); return $form_fields; } add_filter(“attachment_fields_to_edit”, “IMGattachment_fields”, null, 2); function my_image_attachment_fields_save($post, $attachment) { if ( isset($attachment[‘imageClass’]) ) update_post_meta($post[‘ID’], ‘_imageClass’, $attachment[‘imageClass’]); return $post; } add_filter(“attachment_fields_to_save”, “my_image_attachment_fields_save”, null, … Read more

How to show all posts of the category in wordpress?

<?php $args = array( ‘category’ => 7, ‘post_type’ => ‘post’ ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <h2><a href=”https://wordpress.stackexchange.com/questions/17496/<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php endforeach; ?> just change the category id (number 7) and change the post_type that was in the plugin to learn more about … Read more

Stop WP from creating “Sample Page” and “Hello World!” post

If you’re using Multisite The accepted answer is destructive in that it cancels all other set-up items in the overridden function. A less destructive way to do it for multisite installs is to delete the default content during new blog creation by hooking in to wpmu_new_blog add_action( ‘wpmu_new_blog’, ‘delete_wordpress_defaults’, 100, 1 ); function delete_wordpress_defaults(){ // … Read more

How to retrieve text only from wp_content() not from wp_excerpt()?

Or even simpler: echo wp_strip_all_tags( get_the_content() ); By using: get_the_content() Retrieve the post content. (Must be used in a Loop) An important difference from the_content() is that get_the_content() does not pass the content through the ‘the_content‘. This means that get_the_content() will not auto-embed videos or expand shortcodes, among other things. wp_strip_all_tags() Properly strip all HTML … Read more

What is the use of to_ping and pinged column?

to_ping is a list of URLs WordPress should send pingbacks to. pinged is a list of URLs WordPress has sent pingbacks to. Do not use these fields for something else. They are parsed many times in core code (69 matches for to_ping); their format is fixed. You cannot reduce the query load by using these … Read more

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