• I downloaded and added a custom page template, but when I added a plugin to the template, the plugin was not displaying and working properly. When I added the get-header()and get-footer() function to the php file of the template, the custom page displayed all the menus, colors, etc. to the page and the background color was changed from blue to the yellow color of the default template,which I didn’t wanted.
    I then added the following code to the functions.php file:

    function mypage_head() {
        echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/OldSkool-src/style.css">'."\n";
    }
    add_action('wp_head', 'mypage_head');

    I also added the following code to the custom page template’s php file before </head>:

    <?php add_action( 'wp_print_styles', 'mypage_head', 11 );
    ?>
    <?php wp_head(); ?>

    This resulted in the rendering of the correct custom page with the plugin working, although not fully, but my other pages were completely messed up.My other pages were rendering the CSS of both the default and the custom template.

    Please help me to resolve this so that the custom page is rendered correctly, the plugin works correctly and the other pages are rendereed correctly.

    I am new to wordpress, php and CSS, so kindly bear with me.

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • YOur customized function is to add style to all pages. so you saw both default and custom css.

    What’s the differences between your custom template and default template?

    Thread Starter pl2prosperity

    (@pl2prosperity)

    My custom template is a Sales Page which do not have any menu, sidebars, etc. The css is completely different than that of the default template. Here are the links of both of them- Custom Default

    Hi,

    I don’t think you need to add styles to both the custom template and default template. These templates looks good without OldSkool-src/style.css added.

    Some plugins need wp_head() and wp_footer() to work. So please make sure your custom template included these two hooks. This is the code you need to check to make the plugin work.

    Thread Starter pl2prosperity

    (@pl2prosperity)

    Hi,
    Thanks for your help.

    Should I add just <?php wp_head(); ?> to OldSkool.php before </head> or do I need to add something more?

    I have already added <?php wp_footer(); ?> here:

    </div>
      <div id="footer">
          <strong><?php wp_footer(); ?><a href="https://www.planstoprosperity.com" style="color:#FFFFFF" target="_blank"><font color="#FFFFFF"></a></font></strong>
      </div>
    </div>
    </body>
    </html>

    Kindly guide me on this as I am new to wordpress,php, and css.

    This is also my problem and having a hard time resolving it! Thanks for the help codingpet!

    @pl2prosperity,

    As far as I know, yes.

    @robertjonesguy,

    Great to see it solved your issue. ??

    Thread Starter pl2prosperity

    (@pl2prosperity)

    Hi,

    When I add <?php wp_footer(); ?> before </head> in OldSkool.php, the plugin comes back and works, but the background color turns to that of the default template.

    Please take a look here.

    Now what should be done?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom Page template issue’ is closed to new replies.