Goodvalley

Member

Forum Replies Created

  • Well, as I said I’m trying to make Graphene show my custom fields / custom posts.

    In this example, they are books. But I have to make some different custom posts types for my projects.

    This doesn’t have anything to do with categories or normal posts/pages.

    As you can see, the code is intended to make my custom fields appear into a Custom Post type named “books”.

    The problem is that every explanation about making they appear gives an example of themes with basic / typical single.php and page.php files, which usually have the WordPress loop inserted in a very clear way.

    In the case of Graphene, one has to go to loop-single and loop-page, but even in those files there’s no easy way to find where or how to put a code which in other more simple themes is easier. So I would like to know which is the best or more efficient way to do it, wether it needs a new specific php file (single-book.php – loop-book.php) on my child theme or in a function inserted via an action hook somewhere.

    I hope this is more clear, thanks Kenneth.

    Update:

    The only way I’ve managed to put my code to be output is by creating a loop-book.php file in the child theme, then copy-paste loop-single.php on it. And then inserting the code like so:

    <div class="entry-content clearfix">

    <?php do_action( 'graphene_before_post_content' ); ?>

    <?php /* Social sharing buttons at top of post */ ?>
    <?php if ( stripos( $graphene_settings['addthis_location'], 'top' ) !== false ) { graphene_addthis( get_the_ID() ); } ?>

    <?php /* The full content */ ?>
    <?php the_content(); ?>
    <ul>
    <li><strong>ISBN: </strong><?php echo(types_render_field( "isbn", array( 'raw' => true) )); ?></li>
    <li><strong>Author: </strong><?php echo(types_render_field( "author", array( 'raw' => true) )); ?></li>
    <li><strong>Title: </strong><?php echo(types_render_field( "title", array( 'raw' => true) )); ?></li>
    <li><strong>Part of a Series: </strong><?php echo(types_render_field( "series", array( 'raw' => true) )); ?></li>
    <li><strong>Name of the Series: </strong><?php echo(types_render_field( "series-name", array( 'raw' => true) )); ?></li>
    <li><strong>Year of publishing: </strong><?php echo(types_render_field( "year-of-publishing", array( 'raw' => true) )); ?></li>
    <li><strong>Language: </strong><?php echo(types_render_field( "language", array( 'raw' => true) )); ?></li>
    <li><strong>Awarded with: </strong><?php echo(types_render_field( "awards", array( 'raw' => true) )); ?></li>
    </ul>
    <?php wp_link_pages( array( 'before' => '<div class="link-pages"><p><strong>' . __( 'Pages:','graphene' ) . '</strong> ', 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>

    <?php do_action( 'graphene_after_post_content' ); ?>

    </div>

    I understand this is not correct in any way, but it shows the data that I need. I would like to know how to do it the correct and efficient way.

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)