Change View Full Post

  • Admin

    Syahir Hakim

    #17562

    Where you have ?> followed directly by <?php, delete them both. You don’t need to keep closing and opening the PHP codes.

    Anonymous

    #17563

    Try this one. But keep a copy of your original in case this throws things completely out of whack!!

    <?php
    function graphene_slider_post_types(){
    return array('post', 'page');
    }
    add_filter( 'graphene_slider_post_type', 'graphene_slider_post_types' );
    // attaches the function my_post_nav to the hook graphene_post_nav
    add_action ('graphene_after_post_content', 'my_post_nav');
    // our function

    function my_post_nav(){
    // this will allow us to use other hooks but still only show on single posts
    if ( is_single() && ! is_page() ) : ?>
    <div id="my-post-nav"> <!-- div to contain your links -->
    <?php previous_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Previous page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?> |
    <?php next_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Next page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?>
    </div>
    <?php endif;
    }

    /******
    * these next two remove the graphene breadcrumb and then add one
    * which does not appear on the home page
    *****/

    // has to be called after the action is added
    add_action ('after_setup_theme', 'wmrt_remove_graphene_bc');

    function wmrt_remove_graphene_bc() {
    remove_action ('graphene_top_content', 'graphene_breadcrumb_navxt');
    }
    add_action('graphene_top_content', 'wmrt_breadcrumb_navxt');

    function wmrt_breadcrumb_navxt () {
    //by calling this at this point is_home() works!
    if ((function_exists('bcn_display')) && (!(is_front_page()))) {
    echo '<div class="breadcrumb">';
    bcn_display();
    echo '</div>';
    }
    }

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'View full post' => 'Read More',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );
    ?>

    raindance

    #17564

    Hmmm…well so still not letting me save anything in graphene options and I now I have:

    <?php

    function graphene_slider_post_types(){

    return array(‘post’, ‘page’);

    }

    add_filter( ‘graphene_slider_post_type’, ‘graphene_slider_post_types’ );

    // attaches the function my_post_nav to the hook graphene_post_nav

    add_action (‘graphene_after_post_content’, ‘my_post_nav’);

    // our function

    function my_post_nav(){

    // this will allow us to use other hooks but still only show on single posts

    if ( is_single() && ! is_page() ) : ?>

    <div id=”my-post-nav”> <!– div to contain your links –>

    <?php previous_post_link_plus( array(

    ‘order_by’ => ‘menu_order’,

    ‘loop’ => false,

    ‘max_length’ => 0,

    ‘tooltip’ => ‘Previous page’,

    ‘in_same_cat’ => true,

    ‘ex_cats’ => ’12’

    ) );?> |

    <?php next_post_link_plus( array(

    ‘order_by’ => ‘menu_order’,

    ‘loop’ => false,

    ‘max_length’ => 0,

    ‘tooltip’ => ‘Next page’,

    ‘in_same_cat’ => true,

    ‘ex_cats’ => ’12’

    ) );?>

    </div>

    <?php endif; ?>

    <?php } ?>

    <?php

    /******

    * these next two remove the graphene breadcrumb and then add one

    * which does not appear on the home page

    *****/

    // has to be called after the action is added

    add_action (‘after_setup_theme’, ‘wmrt_remove_graphene_bc’);

    function wmrt_remove_graphene_bc() {

    remove_action (‘graphene_top_content’, ‘graphene_breadcrumb_navxt’);

    }

    add_action(‘graphene_top_content’, ‘wmrt_breadcrumb_navxt’);

    function wmrt_breadcrumb_navxt () {

    //by calling this at this point is_home() works!

    if ((function_exists(‘bcn_display’)) && (!(is_front_page()))) {

    echo ‘<div class=”breadcrumb”>’;

    bcn_display();

    echo ‘</div>’;

    }

    }

    function graphene_filter_gettext( $translated, $original, $domain ) {

    $strings = array(

    ‘View full post’ => ‘Read More’,

    );

    if ( ! empty( $strings[$original] ) ) {

    $translations = &get_translations_for_domain( $domain );

    $translated = $translations->translate( $strings[$original] );

    }

    return $translated;

    }

    add_filter( ‘gettext’, ‘graphene_filter_gettext’, 10, 3 );

    ?>

    `

    remove more?? It was working ok until I added that last bit.

    raindance

    #17565

    This is what I have now:

    <?php
    function graphene_slider_post_types(){
    return array('post', 'page');
    }
    add_filter( 'graphene_slider_post_type', 'graphene_slider_post_types' );
    // attaches the function my_post_nav to the hook graphene_post_nav
    add_action ('graphene_after_post_content', 'my_post_nav');
    // our function
    function my_post_nav(){
    // this will allow us to use other hooks but still only show on single posts
    if ( is_single() && ! is_page() ) : ?>
    <div id="my-post-nav"> <!-- div to contain your links -->
    <?php previous_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Previous page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?> |
    <?php next_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Next page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?>
    </div>
    <?php endif; ?>
    <?php } ?>
    <?php
    /******
    * these next two remove the graphene breadcrumb and then add one
    * which does not appear on the home page
    *****/
    // has to be called after the action is added
    add_action ('after_setup_theme', 'wmrt_remove_graphene_bc');
    function wmrt_remove_graphene_bc() {
    remove_action ('graphene_top_content', 'graphene_breadcrumb_navxt');
    }
    add_action('graphene_top_content', 'wmrt_breadcrumb_navxt');
    function wmrt_breadcrumb_navxt () {
    //by calling this at this point is_home() works!
    if ((function_exists('bcn_display')) && (!(is_front_page()))) {
    echo '<div class="breadcrumb">';
    bcn_display();
    echo '</div>';
    }
    }
    ?>

    And I get the same error,

    Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:51) in /home/juicytrv/public_html/wp-includes/pluggable.php on line 934

    Anonymous

    #17566

    Make sure you have NO space between your opening (line 1) and your closing (last line) php tags.

    This usually causes the headers already sent error.

    Anonymous

    #17567

    Sorry, what I meant is no white space BEFORE the opening php tag (line 1) and no white space below your closing php tag (last line).

    raindance

    #17568

    Yup…no spaces…unless you’re seeing one I’m missing?

    It had all kinds of spaces before though and was working 🙂

    Anonymous

    #17569

    Did you try my copy I posted on the prior page?

    raindance

    #17570

    oh my gosh I missed it that you pasted that in…thanks…it worked perfectly, THANKS!

    Anonymous

    #17571

    My pleasure!!

    PHP is kinda funny sometimes. It’s a little more finicky than basic HTML. Be sure to follow Sayhir’s comment about unnecessary opening and closing php tags when you are adding functions to your child theme.

Viewing 10 posts - 11 through 20 (of 32 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum