Viewing 1 replies (of 1 total)
  • Plugin Author Joseph Hinson

    (@jhinson)

    Hi AngEngland,

    The plugin doesn’t work that way at present. The [booklinks] shortcode only pulls in book links on the individual book pages, however, it’s a good idea.

    If you use the code below and overwrite the contents of ot_book_shortcodes.php you can use the shortcode by passing a book ID like:

    [booklinks id=”470″] (where 470 is the ID of the desired book).

    Or you can hang tight and I’ll update it in the next version of the plugin.

    <?php
    // [booklinks text="hide" id="bookID"]
    function products_booklinks($atts) {
    	extract(shortcode_atts(array(
    		"text" => 'show',
    		"id" => ''
    	), $atts));
    	global $post;
    	if ($id) {
    		$theID = $id;
    	} else {
    		$theID = $post->ID;
    	}
    	$amazon = get_post_meta($theID, 'amazon_url', true);
    	$bn = get_post_meta($theID, 'bn_url', true);
    	$ceoread = get_post_meta($theID, 'ceoread_url', true);
    	$indie = get_post_meta($theID, 'indie_url', true);
    	$ibooks = get_post_meta($theID, 'ibooks_url', true);
    	$itunes = get_post_meta($theID, 'itunes_url', true);
    	$audible = get_post_meta($theID, 'audible_url', true);
    	$bam = get_post_meta($theID, 'bam_url', true);
    	$return = '';
    	if ($text != 'hide') {
    		$return .='<div class="order-book"><p class="booklinks"><span class="buy-book-text">Buy the book:<br /></span>';
    		$return .= ot_booklinks( $amazon, $bn, $ceoread, $ibooks, $indie, $itunes, $audible, $bam);
    		$return .='</p></div>';
    	} else {
    		$return .= ot_booklinks( $amazon, $bn, $ceoread, $ibooks, $indie, $itunes, $audible, $bam);
    	}
    	return $return;
    }
    add_shortcode("booklinks", "products_booklinks");
Viewing 1 replies (of 1 total)
  • The topic ‘Short Code isn't pulling links’ is closed to new replies.