How Can I Properly put this html in my PHP script

I want to add my printerfriendly button to all of my posts under my header. this is the HTML of the button:

    <script>var pfHeaderImgUrl = '';var pfHeaderTagline = '';var pfdisableClickToDel = 0;var pfHideImages = 0;var pfImageDisplayStyle = 'right';var pfDisablePDF = 0;var pfDisableEmail = 0;var pfDisablePrint = 0;var pfCustomCSS = '';var pfBtVersion='1';(function(){var js, pf;pf = document.createElement('script');pf.type = 'text/javascript';if('https:' == document.location.protocol){js='https://pf-cdn.printfriendly.com/ssl/main.js'}else{js='http://cdn.printfriendly.com/printfriendly.js'}pf.src=js;document.getElementsByTagName('head')[0].appendChild(pf)})();</script><a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;-webkit-box-shadow:none;box-shadow:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/>
    </a>

As for now, the example I placed in the HTML printerfriendly code that was generated in my side bar that you can see here :

Read More

http://iamdentistry.com/archive/dentistry/about-dental-night-guards/

I do not know how to move this button to where I want. I want to place it in the same line as the Leave A Response button under the posts header to the far right.

I asked the author of the theme and all they told me was that I need to add the code to the content.php file of my theme which is this :

        <article id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

<?php if ( is_singular( get_post_type() ) ) : ?>

    <?php
    $format = get_post_format();
    get_template_part( 'post-header', $format );
    ?>

    <header class="entry-header">
        <?php if (
                fearless_get_option( 'singular_featured_image_enabled' )
                && 'audio' != $format
                && 'gallery' != $format
                && 'video' != $format
            ) {
                fearless_post_thumbnail();
            }
        ?>

        <h1 class="entry-title"><?php single_post_title(); ?></h1>
        <?php
        printf(
            apply_atomic_shortcode(
                'entry_byline',
                '<div class="entry-byline">' . __( 'Posted by [entry-author] on [entry-published] in [entry-terms taxonomy="category"] | %1$s [entry-comments-link before=" | "]', 'fearless' ) . '</div>'
            ),
            sprintf(
                _n(
                    '1 View',
                    '%1$s Views',
                    get_post_meta( get_the_ID(), 'Views', true ),
                    'fearless'
                ),
                get_post_meta( get_the_ID(), 'Views', true )
            )
        );
        ?>
    </header><!-- .entry-header -->

    <div class="entry-content">
        <?php if ( is_singular( 'post' ) ) get_template_part( 'review-box' ); ?>
        <?php the_content(); ?>
        <?php wp_link_pages( array( 'before' => '<p class="page-links">' . '<span class="before">' . __( 'Pages:', 'fearless' ) . '</span>', 'after' => '</p>' ) ); ?>
    </div><!-- .entry-content -->

    <footer class="entry-footer">
        <?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms before="Posted in " taxonomy="category"] [entry-terms before="| Tagged "]', 'fearless' ) . '</div>' ); ?>
    </footer><!-- .entry-footer -->

<?php else : ?>

    <?php global $fearless_blogroll_layout; ?>

    <?php fearless_post_thumbnail( $fearless_blogroll_layout['thumbnail_size'] ); ?>

    <header class="entry-header">
        <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '">', '</a></h2>' ); ?>
        <?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( '[entry-author] / [entry-published]', 'fearless' ) . '</div>' ); ?>
    </header><!-- .entry-header -->

    <?php if ( $fearless_blogroll_layout['excerpt_length'] ) : ?>
        <div class="entry-summary">
            <?php echo fearless_get_the_excerpt( $fearless_blogroll_layout['excerpt_length'] ); ?>
            <?php wp_link_pages( array( 'before' => '<p class="page-links">' . '<span class="before">' . __( 'Pages:', 'fearless' ) . '</span>', 'after' => '</p>' ) ); ?>
        </div><!-- .entry-summary -->
    <?php endif; ?>

    <?php if ( '1col-thumb' != $fearless_blogroll_layout['style'] ) : ?>
        <p class="more-link-wrapper"><a href="<?php the_permalink(); ?>" class="read-more button"><?php _e( 'Read More &raquo;', 'fearless' ); ?></a></p>
    <?php endif; ?>

<?php endif; ?>

    </article><!-- .hentry -->

—– Dave this is how I attempted what you asked :

    <?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( '[entry-author] / [entry-published]', 'fearless' ) . '<script>var pfHeaderImgUrl = '';var pfHeaderTagline = '';var pfdisableClickToDel = 0;var pfHideImages = 0;var pfImageDisplayStyle = 'right';var pfDisablePDF = 0;var pfDisableEmail = 0;var pfDisablePrint = 0;var pfCustomCSS = '';var pfBtVersion='1';(function(){var js, pf;pf = document.createElement('script');pf.type = 'text/javascript';if('https:' == document.location.protocol){js='https://pf-cdn.printfriendly.com/ssl/main.js'}else{js='http://cdn.printfriendly.com/printfriendly.js'}pf.src=js;document.getElementsByTagName('head')[0].appendChild(pf)})();</script><a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;-webkit-box-shadow:none;box-shadow:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a></div>' ); 
    ?>

—————Christopher Pecoraro , this was my attempt:

    <article id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

<?php if ( is_singular( get_post_type() ) ) : ?>

    <?php
    $format = get_post_format();
    get_template_part( 'post-header', $format );
    ?>

    <header class="entry-header">
        <?php if (
                fearless_get_option( 'singular_featured_image_enabled' )
                && 'audio' != $format
                && 'gallery' != $format
                && 'video' != $format
            ) {
                fearless_post_thumbnail();
            }
        ?>

        <h1 class="entry-title"><?php single_post_title(); ?></h1>
        $link_text = '<script>var pfHeaderImgUrl = '';var pfHeaderTagline = '';var pfdisableClickToDel = 0;var pfHideImages = 0;var pfImageDisplayStyle = 'right';var pfDisablePDF = 0;var pfDisableEmail = 0;var pfDisablePrint = 0;var pfCustomCSS = '';var pfBtVersion='1';(function(){var js, pf;pf = document.createElement('script');pf.type = 'text/javascript';if('https:' == document.location.protocol){js='https://pf-cdn.printfriendly.com/ssl/main.js'}else{js='http://cdn.printfriendly.com/printfriendly.js'}pf.src=js;document.getElementsByTagName('head')[0].appendChild(pf)})();</script><a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;-webkit-box-shadow:none;box-shadow:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a>';
    printf(
        apply_atomic_shortcode(
            'entry_byline',
            '<div class="entry-byline">' . __( 'Posted by [entry-author] on [entry-published] in [entry-terms taxonomy="category"] | %1$s [entry-comments-link before=" | "]', 'fearless' ) . $link_text . '</div>'
        ),
            sprintf(
                _n(
                    '1 View',
                    '%1$s Views',
                    get_post_meta( get_the_ID(), 'Views', true ),
                    'fearless'
                ),
                get_post_meta( get_the_ID(), 'Views', true )
            )
        );
        ?>
    </header><!-- .entry-header -->

    <div class="entry-content">
        <?php if ( is_singular( 'post' ) ) get_template_part( 'review-box' ); ?>
        <?php the_content(); ?>
        <?php wp_link_pages( array( 'before' => '<p class="page-links">' . '<span class="before">' . __( 'Pages:', 'fearless' ) . '</span>', 'after' => '</p>' ) ); ?>
    </div><!-- .entry-content -->

    <footer class="entry-footer">
        <?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms before="Posted in " taxonomy="category"] [entry-terms before="| Tagged "]', 'fearless' ) . '</div>' ); ?>
    </footer><!-- .entry-footer -->

<?php else : ?>

    <?php global $fearless_blogroll_layout; ?>

    <?php fearless_post_thumbnail( $fearless_blogroll_layout['thumbnail_size'] ); ?>

    <header class="entry-header">
        <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '">', '</a></h2>' ); ?>
        <?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( '[entry-author] / [entry-published]', 'fearless' ) . '</div>' ); ?>
    </header><!-- .entry-header -->

    <?php if ( $fearless_blogroll_layout['excerpt_length'] ) : ?>
        <div class="entry-summary">
            <?php echo fearless_get_the_excerpt( $fearless_blogroll_layout['excerpt_length'] ); ?>
            <?php wp_link_pages( array( 'before' => '<p class="page-links">' . '<span class="before">' . __( 'Pages:', 'fearless' ) . '</span>', 'after' => '</p>' ) ); ?>
        </div><!-- .entry-summary -->
    <?php endif; ?>

    <?php if ( '1col-thumb' != $fearless_blogroll_layout['style'] ) : ?>
        <p class="more-link-wrapper"><a href="<?php the_permalink(); ?>" class="read-more button"><?php _e( 'Read More &raquo;', 'fearless' ); ?></a></p>
    <?php endif; ?>

<?php endif; ?>

    </article><!-- .hentry -->

Related posts

Leave a Reply

2 comments

  1. Place your code where it says [YOUR CODE HERE]. If you want to be lazy, just put it right in there. Note that it is VERY IMPORTANT that you escape the single quotes in the code by putting a in front of them

    <?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( '[entry-author] / [entry-published]', 'fearless' ) . '[YOUR CODE HERE]</div>' ); ?>
    

    You might want to do escape the single quotes this way:

    $str = [YOUR CODE];
    string addslashes ( string $str );
    

    Then place $str in the code like …'fearless' ) . $str . '</div>'
    You could also just replace all the single quotes with double quotes.

  2. Could you try something like this (not elegant at all)?

    replace:

    <?php
            printf(
                apply_atomic_shortcode(
                    'entry_byline',
                    '<div class="entry-byline">' . __( 'Posted by [entry-author] on [entry-published] in [entry-terms taxonomy="category"] | %1$s [entry-comments-link before=" | "]', 'fearless' ) . '</div>'
                ),
    

    with:

    $link_text = '<script>var pfHeaderImgUrl = '';var pfHeaderTagline = '';var pfdisableClickToDel = 0;var pfHideImages = 0;var pfImageDisplayStyle = 'right';var pfDisablePDF = 0;var pfDisableEmail = 0;var pfDisablePrint = 0;var pfCustomCSS = '';var pfBtVersion='1';(function(){var js, pf;pf = document.createElement('script');pf.type = 'text/javascript';if('https:' == document.location.protocol){js='https://pf-cdn.printfriendly.com/ssl/main.js'}else{js='http://cdn.printfriendly.com/printfriendly.js'}pf.src=js;document.getElementsByTagName('head')[0].appendChild(pf)})();</script><a href="http://www.printfriendly.com" style="color:#6D9F00;text-decoration:none;" class="printfriendly" onclick="window.print();return false;" title="Printer Friendly and PDF"><img style="border:none;-webkit-box-shadow:none;box-shadow:none;" src="http://cdn.printfriendly.com/button-print-grnw20.png" alt="Print Friendly and PDF"/></a>';
            printf(
                apply_atomic_shortcode(
                    'entry_byline',
                    '<div class="entry-byline">' . __( 'Posted by [entry-author] on [entry-published] in [entry-terms taxonomy="category"] | %1$s [entry-comments-link before=" | "]', 'fearless' ) . $link_text . '</div>'
                ),