Return to Support

each child-pages shown in seperate boxes with complete content downside a page

Home Forums Graphene WordPress theme Support each child-pages shown in seperate boxes with complete content downside a page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4338
    sonmarcel
    Member

    Hello,

    on my site I have a few child-pages which don’t got much content so everything fits fine in one child-page. To seperate the content parts clearly I’d like to use them on the child-page by boxes like they are shown as preview in the first Layer: http://www.sladek-it.de/individuelle-programmierung (user “marcel”, password “marcel”, scroll down)

    I dont’t have any experience with php but other programming languages. It should be possible to make a check if its page “xy”. When true, show me the whole content, not cutting something and don’t show the button “View page” cause in this case there would no need for it. All other pages should have the default-values inclusive the button “View page”.

    Does anyone could please help me how to make this work? What template I have to change and with what code?

    Many thanks!

    Bye,sonmarcel

    #27968
    Syahir Hakim
    Keymaster

    This is not tested, but you can do something like this in your child theme’s functions.php file:

    function graphene_replace_child_excerpt( $content ){
    if ( is_page( ## ) ) // Replace ## with the child page ID
    $content = apply_filters( get_the_content() );

    return $content;
    }
    add_filter( 'the_excerpt', 'graphene_replace_child_excerpt' );

    #27969
    sonmarcel
    Member

    Hello Syahir,

    many thanks for your code! I have created a child theme with only style.css (edited Theme Name, Template and @import) and functions.php. In functions.php there is only your code within “<?php” and “?>” It seems there is a problem with the function:

    Warning: Missing argument 2 for apply_filters(), called in (...)/themes/graphene_child/functions.php on line 4 and defined in (...)/wp-includes/plugin.php on line 134

    Line 4 is $content = apply_filters( get_the_content() );. It seems the request needs a second argument.

    What argument needs it?

    Bye,

    sonmarcel

    #27970
    Josh
    Member

    Perhaps this will work?

    function graphene_replace_child_excerpt( $content ){
    if ( is_page( ## ) ) // Replace ## with the child page ID
    $content = get_the_content();
    $content = apply_filters('the_content', $content);

    return $content;
    }
    add_filter( 'the_excerpt', 'graphene_replace_child_excerpt' );

    #27971
    sonmarcel
    Member

    Hello Josh,

    many thanks! This works great.

    Now it would be best if the button to show the page would be deleted from this individual site. Is this possible? Or would it be to complex?

    Bye,

    sonmarcel

    #27972
    Syahir Hakim
    Keymaster

    Oops, yea I forget the the_content for the first argument of the apply_filters(). Thanks Josh!

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

You must be logged in to reply to this topic.