Support » Themes and Templates » Custom Page template issue

  • pl2prosperity


    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)
  • codingpet


    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?

    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


    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.

    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 id="footer">
          <strong><?php wp_footer(); ?><a href="" style="color:#FFFFFF" target="_blank"><font color="#FFFFFF"></a></font></strong>

    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!


    As far as I know, yes.


    Great to see it solved your issue. 🙂


    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.