[theme-reviewers] Updating Custom Backgrounds and Custom Headers for WordPress 3.4

Edward Caissie edward.caissie at gmail.com
Tue Apr 17 11:32:31 UTC 2012


I'll try to get one of my plugins that uses `get_theme_data` backward
compatibility and `wp_get_theme` uploaded later today ...
... working examples always help me to sort out these issues much quicker.

I've a post or two to write as well on WPFirstAid that will take an example
or two into effect as well.


Cais.


On Tue, Apr 17, 2012 at 1:58 AM, Konstantin Obenland <konstantin at obenland.it
> wrote:

> What I did in The Bootstrap was defining get_ custom_header():
>
>
>  155<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L155>
> 156<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L156>
> if ( ! function_exists( 'get_custom_header' ) ) : 157<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L157>
> /** 158<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L158>  *
> Get the header image data. 159<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L159>
>  * 160<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L160>  *
> @author      Automattic 161<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L161>  *
> @since       1.2.5 - 11.04.2012 162<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L162>
>  * 163<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L163>  *
> @return      object 164<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L164>
>  */ 165<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L165>
> function get_custom_header() { 166<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L166>
>        return (object) array( 167<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L167>
>               'url'           => get_header_image(), 168<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L168>
>               'thumbnail_url' => get_header_image(), 169<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L169>
>               'width'         => HEADER_IMAGE_WIDTH, 170<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L170>
>               'height'        => HEADER_IMAGE_HEIGHT, 171<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L171>
>       ); 172<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L172>
> } 173<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L173>
> endif; // get_custom_header 17<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L174>
> 4  175<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L175>
> 176<http://themes.trac.wordpress.org/browser/the-bootstrap/1.2.5/inc/custom-header.php?rev=19995#L176> /*
> End of file custom-header.php */
>
> Sent from my iPhone
>
> On Apr 17, 2012, at 1:03, David Law <
> wp-hackers at google-adsense-templates.co.uk> wrote:
>
> On Mon, 16 Apr 2012 09:04:58 -0700, you wrote:
>
> Can do the same for Custom Headers, but think it will be messy. Anyone
>
> got a 'good' solution up and running?
>
>
> Hi David!
>
>
> A new version of P2 was released recently. It has custom header support
>
> for 3.4 and previous versions.
>
>
> You can see the code here:
>
> http://themes.svn.wordpress.org/p2/1.4.0/inc/custom-header.php
>
>
> Thanks Mike,
>
> That's a much simpler code solution than I was thinking of using.
>
> Think I have it working now.
>
> For those looking for backwards compatability with the height and
> width attributes of the image code within their header.php files this
> works
>
> width="<?php if(function_exists('get_custom_header')) {echo
> get_custom_header()->width;} else {echo HEADER_IMAGE_WIDTH;} ?>"
> height="<?php if(function_exists('get_custom_header')) {echo
> get_custom_header()->height;} else {echo HEADER_IMAGE_HEIGHT;} ?>"
>
> David
> --
> http://www.stallion-theme.com/ Stallion WordPress SEO Theme
> http://www.stallion-theme.com/stallion-wordpress-seo-plugin Stallion
> WordPress SEO Plugin
>
>
> -Mike
>
> _______________________________________________
>
> theme-reviewers mailing list
>
> theme-reviewers at lists.wordpress.org
>
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120417/84cb5f32/attachment-0001.htm>


More information about the theme-reviewers mailing list