Post Attachment missing head (stylesheets/js/what-not)

A good place to start is with the template hierarchy flow chart. http://codex.wordpress.org/images/1/18/Template_Hierarchy.png I’m always consulting this page. When you say modified twenty eleven, what do you mean? The image.php file is what handles image attachment pages in twenty eleven. I’m not familiar entirely with how it works, but it may be also making a … Read more

How to wrap this Link with an Image?

Try passing in the image into the functions themselves: <?php $previous_image = “<img src=”http://domain.com/path/to/image/” alt=”Previous Posts”>”; $next_image = “<img src=”http://domain.com/path/to/image/” alt=”Newer Posts”>”; ?> <span class=”nav-previous”><?php previous_image_link( false, $previous_image ); ?></span> <span class=”nav-next”><?php next_image_link( false, $next_image ); ?></span>

Showing the attachment for a page?

Use, wp_get_attachment_image_src( $attachment_id, $size); Specify the size parameter as follows; $size (string/array) (optional) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of … Read more

How to create an identical second loop for attachments?

You don’t need a second loop. Just save all the data you need later during the first loop. Sample code, not tested, just a hint: <ul class=”ei-slider-large”> <?php // Here we store the data. $second_loop = array(); // Main loop $main_query = new WP_Query( array( ‘category_name’ => ‘featured’, ‘posts_per_page’ => 3 ) ); if( $main_query->have_posts() … Read more

ID of images from gallery

You can find out the IDs of which images are included in a gallery by switching to the Text editor tab and look for a piece of code like this: The comma-separated list of image IDs are enclosed in the ids attribute If you’re looking to find out IDs of existing images in order to … Read more

wp_get_attachment_link() add rel attribute if the link points to direct image

add_filter( ‘wp_get_attachment_link’, ‘sant_prettyadd’, 10, 6); function sant_prettyadd ($content, $id, $size, $permalink, $icon, $text) { if ($permalink) { return $content; } $content = preg_replace(“/<a/”,”<a rel=\”prettyPhoto[slides]\””,$content,1); return $content; } Update: function sant_prettyadd checks permalink argument. if the permalink = true then it returns the content as it is. if the permalink = false then it skips to … Read more

get_permalink to attachment not working

The Problem is that you query for Post Status null. Try setting this to publish or inherit, because get_permalink is a function for published items, not for any post status. This is because Permalinks to items with a status like draft should not be shown to the user.

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