Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author mooberrydreams

    (@mooberrydreams)

    I’m not sure what you mean. If you fill in data for those fields they should be showing up on your page. Is that not happening for you? Can you include a link to your site?

    Thanks,
    MBD

    Thread Starter mcgrailm

    (@mcgrailm)

    Heh, sorry ai forgot the most important part lol

    what I mean is from the book grid settings so that when I put the book grid on a page I can show what details I want to show.

    thanks again
    Mike

    Plugin Author mooberrydreams

    (@mooberrydreams)

    Ah, gotcha.

    There isn’t currently a way to include additional information through settings on the admin screen, but if you want to write some PHP, there is a hook you can use to add information.

    The hook name is mbdb_book_grid_after_link and the first argument passed is the book ID (post ID) which you can use to pull the necessary postmeta data from the database.

    I like the idea of customizing the data on the book grid, so I’ll look into adding this into a future version. Thanks!

    Thread Starter mcgrailm

    (@mcgrailm)

    awesome thank you.

    Plugin Author mooberrydreams

    (@mooberrydreams)

    You’re welcome!

    Thread Starter mcgrailm

    (@mcgrailm)

    So I have tried this

    <?php
    /*
    Plugin Name: jw-book-enchance
    */
    defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    function addOptions($post_id){
         $post = get_post($post_id);
    
         return $post_id;
    }
    add_action('mbdb_book_grid_after_link','addOptions');
    ?>

    and also tried echoing and only echo shows output. but it shows it before all the the posts rather than with them.

    not sure what i’m doing wrong

    Plugin Author mooberrydreams

    (@mooberrydreams)

    Argh. My bad. Digging into the code I realize that this should have been a filter on $content. That’s what you’ll need to manipulate.

    I will fix this in v2 which I’m hoping to release in a couple days. I will make this a filter on the $content variable and pass the $postID as an argument. So you would append whatever you want to display to $content and then return $content.

    Sorry for the confusion!

    Plugin Author mooberrydreams

    (@mooberrydreams)

    Okay, now that v2 is posted, you can use the mbdb_book_grid_after_title filter. Here’s an example of adding the published date:

    add_filter('mbdb_book_grid_after_title', 'mbdb_test_grid_after_title', 10, 2);
    function mbdb_test_grid_after_title($content, $bookID) {
    	$pubdate = get_post_meta($bookID, '_mbdb_published', true);
    	$content .= '<h5>' . date('m/d/Y', strtotime($pubdate)) . '</h5>';
    	return $content;
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Additional Feilds’ is closed to new replies.