• Resolved deBlogist

    (@deblogist)


    I’m using GeneratePress Template for one of my Projects. Thanks, nice work.
    To get the appearance as I want to, I’ve modified the content-page.php with that Code:

    <div></div>

    What would be a good solution to maintain updateability?

    Thank for Help

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    Which code did you add? An empty <div> element? What is it doing?

    Let me know 🙂

    Thread Starter deBlogist

    (@deblogist)

    `>

    Hi, that’s my Workaround to reproduce the Layout of a Clients Page:

    content-page.php ->

    ?>

    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?> <?php generate_article_schema( ‘CreativeWork’ ); ?>>
    <!– Template Mod. formdesign.ch START –>
    <div><img id=”maintop” class=”aligncenter size-full wp-image-75″ src=”https://site.ch/path/banner-01-wide.jpg&#8221; alt=”” width=”100%” /></div>
    <!– Template Mod. formdesign.ch END –>
    <div class=”inside-article”>
    <?php
    /**
    * generate_before_content hook.

    • This reply was modified 5 years, 8 months ago by deBlogist.
    Theme Author Tom

    (@edge22)

    So what if instead of editing the theme file, you added this function to your child theme:

    add_action( 'generate_before_content', 'tu_add_content_before_content' );
    function tu_add_content_before_content() {
        ?>
    
        Your custom content in here.
    
        <?php
    }

    Let me know 🙂

    Thread Starter deBlogist

    (@deblogist)

    Thanks to help me in the right direction.

    I got it work using this:

    function wpdev_before_after($content) {
        if(is_page() ) {
            $beforecontent = '<div><img id="maintop" class="aligncenter size-full wp-image-75" src="https://path/banner-01-wide.jpg" alt="" width="100%"  /></div>';
            $aftercontent = '';
            $fullcontent = $beforecontent . $content . $aftercontent;
        } else {
            $fullcontent = $content;
        }
    
       return $fullcontent;
    }
    add_filter('the_content', 'wpdev_before_after');

    Now I have to find how to put it above the Titel too (the Hook is “the_title”), but I think I could figure it out, thanks for your Help.

    • This reply was modified 5 years, 8 months ago by deBlogist.
    • This reply was modified 5 years, 8 months ago by deBlogist.
    • This reply was modified 5 years, 8 months ago by deBlogist.
    Theme Author Tom

    (@edge22)

    No problem! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘content-page.php hardcoded background Image workaround ready for updates’ is closed to new replies.