WordPress.org

Ready to get started?Download WordPress

Forums

Music Affiliate Pro
[resolved] Album Specific Widget Outside of Content (4 posts)

  1. jpmizell
    Member
    Posted 2 years ago #

    Howdy,

    I'm looking to work this widget into spaces outside of my content for better off-site & excerpt reading.

    I don't like it appearing in my excerpts (I'm including all code in my excerpts), so I'd like to grab the iTunes Album Id#, put it into a custom field, and have it push to the widget that is located elsewhere on the post, out of the content section. (similar to a featured image).

    Does something like this exist or will this be a long lonesome journey for me?

    http://wordpress.org/extend/plugins/music-affiliate-pro/

  2. Brady Vercher
    Member
    Plugin Author

    Posted 2 years ago #

    Hi jpmizell,

    Direct support for doing this isn't exactly built in, but it should be possible depending on how comfortable you are modifying your files (back them up before making changes and you should be fine).

    If you're putting the iTunes ID into a custom field, you will need to grab that in your template using get_post_meta().

    Then construct a dummy shortcode string: $shortcode = "[itunes id='$meta_value']"

    And run that through do_shortcode()

    That should allow you to output the widget anywhere outside of the content section.

    Hope that helps.

    - Brady

  3. jpmizell
    Member
    Posted 2 years ago #

    Brady,

    Thanks for the quick word.

    After fumbling with your helpful code suggestions, here's what I've got stashed in single.php

    <!-- iTunes music Box Code -->
    <?php
    	$meta_values = get_post_meta($post->ID, 'itunes_id', true ) ;
    //	echo ' | $meta_values: ', $meta_values ;
    	$itunes_shortcode = "[itunes id='$meta_values']" ;
    //	echo ' | $itunes_shortcode: ' , $itunes_shortcode ;
    	echo do_shortcode( $itunes_shortcode ) ;
    ?>
    <!-- end of iTunes Music Box Code -->

    Thanks for the direction.

    John

  4. jpmizell
    Member
    Posted 2 years ago #

    *Note: The echo lines were a check for functionality. Disregard them.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic