Using featured img as div background

Try something like this: <?php global $post; $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, ” ); $default = get_template_directory_uri().”/assets/images/backgrounds/highway.jpg”; $bgimg = (isset($src[1])) ? $src[0] : $default; ?> <style type=”text/css”> .parallax { background-image: url(<?= $bgimg ?>); } </style> wp_get_attachment_image_src() says it returns false when not found, but for some reason I’ve had bad time with … Read more

Redirect to another page using contact form 7? [closed]

Redirect to another page using contact form 7? [closed]

Include an image within auto the_excerpt?

Yes, you can do that, but you’ll need to tweak the <?php the_excerpt(); ?> function. This is a good article on how to do that: http://aaronrussell.co.uk/legacy/improving-wordpress-the_excerpt/ To sum up the article in case it goes away, put this in your theme’s functions.php file: function improved_trim_excerpt($text) { global $post; if ( ” == $text ) { … Read more

Animated GIF on WordPress posts? [closed]

Animated gifs will not be animated when resized. I see that you’re using the full sized image, but there are parameters added to the src attribute (probably due to some plugin or your theme): From the source: <img class=”size-full wp-image-4604″ title=”Koch snoflake progression” alt=”” src=”http://wewanttolearn.files.wordpress.com/2012/10/snowflake-diagrams1.gif?w=545&amp;h=472″ height=”472″ width=”545″> Take off the parameters ?w=545&amp;h=472, and it should … Read more

Custom header tiling?

You are putting an image into the style attribute – this is wrong. You only need the path, not a tag: <div class=”art-header” style=”background-image:url(“https://wordpress.stackexchange.com/questions/71185/<?php header_image(); ?>”); background-repeat:repeat; height:<?php echo get_custom_header()->height; ?>px; width:<?php echo get_custom_header()->width;?>px;”> </div> After seeing the issue at hand, I would instead suggest this: your HTML: <div class=”art-header”>….</div> Anywhere on the same file … Read more

Display featured image file size, extension, filename, type, orientation?

Question 1: use wp_get_attachment_metadata in the Codex or the search function on this forum! Question 2: Put this in one of your functions. It will echo the Alt text for the image. $img_id = get_post_thumbnail_id( get_the_ID() ); //Note: you may need other methods to get id $alt_text = get_post_meta( $img_id, ‘_wp_attachment_image_alt’, true ); if (!empty … Read more