0

I am trying to add my custom page template to wordpress. I have created a page-portfolio.php to the folder

\wp-content\themes\yoo_master2_wp\layouts

My php file has following content:

<?php
/*
Template Name: My Portfolio
*/
// get warp    
$warp = Warp::getInstance();    

// load main template file    
echo $warp['template']->render('template');

if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <article class="uk-article">

        <?php if (has_post_thumbnail()) : ?>
            <?php
            $width = get_option('thumbnail_size_w'); //get the width of the thumbnail setting
            $height = get_option('thumbnail_size_h'); //get the height of the thumbnail setting
            ?>
            <?php the_post_thumbnail(array($width, $height), array('class' => '')); ?>
        <?php endif; ?>

        <h1 class="uk-article-title"><?php the_title(); ?></h1>

        <?php the_content(''); ?>

        <?php edit_post_link(__('Edit this post.', 'warp'), '<p><i class="uk-icon-pencil"></i> ','</p>'); ?>

    </article>

    <?php endwhile; ?>
<?php endif; ?>

<?php comments_template(); ?>

Here is the tutorial, how it should work (last part).

According to this tutorial I should do the following:

<?php
/*
Template Name: My Portfolio
*/
<?php get_header(); ?>

Put your content here...

<?php get_footer(); ?>

But like this I get only a blank page.

The code above is copied from the page.php in layouts and with the code from this post

But I get following error message:

Fatal error: Class 'Warp' not found in C:\xampp\htdocs\wordpress\wp-content\themes\yoo_master2_wp\layouts\page-portfolio.php on line 6

So, does anyone know the correct way to do in warp7? The documentation did not help

  • Please enable debugging in your wp-config.php. Blank page = error message not shown. – kaiser Feb 18 '14 at 20:58
  • Are you dealing with commercial software? – s_ha_dum May 17 '14 at 18:46
0

The whole doco thing for Warp is confusing. You are supposed to use one of the styles configured under the theme, and you'll find those in a folder such as:

/wp-content/themes/yoo_avenue_wp/styles/red

Add your /layouts folder under here, then copy in any file you want to override from the folder:

/wp-content/themes/yoo_avenue_wp/warp/systems/wordpress/layouts

These are then the files you modify, and Warp will use those in preference to the ones in its own system. Now, to choose the template used, I find it best to copy over 'content.php' This chooses the page name to use based on the post type etc.

However, the code contains:

if ($this["path"]->path("layouts:{$queried_object->post_type}.php")) {
    $content = $queried_object->post_type;
}

and despite what they say in the doco, this means it's looking for a file with the name of the post type 'post_type.php', not 'single-post_type.php'!

Archives are also not looked up using the slug, so I modified my file to be:

} elseif (is_archive()) {

    $content = 'archive';

    if ($this["path"]->path("layouts:{$queried_object->slug}.php")) {
        $content = $queried_object->slug;
    }

Hopefully this helps a few other people not go through the pain I have :)

0

The short answer is, you put the template file in the wrong folder.

WordPress searches the root of your template folder for template files, so you should just put it into \wp-content\themes\yoo_master2_wp, and everything should work out fine.

Also have a look at the Template Hierarchy in the Codex, to understand the structure better, as it is not explained in detail at Yoothemes.

Yoothemes itself is a bit confusing here, as they use the same engine (Warp) to power both their Joomla and WordPress templates - this is not an ideal approach. They started out building Joomla templates, and jumped onto the WordPress bandwagon afterwards, trying to modify their existing developments to fit onto another CMS.

  • Thank you so much, unfortunatedly the problem is still the same. I added the file now only to the theme folder, but I still receive the error Fatal error: Class 'Warp' not found in C:\xampp\htdocs\wordpress\wp-content\themes\yoo_master2_wp\page-portfolio.php on line 6. If I delete those added lines with the template render and the warp instance, I get the white page with post content again – Owl Feb 18 '14 at 20:02
  • This is the Problem with the WARP engine. It does not handle the Content like WordPress does. Unfortunately, I neither know how it works exactly, nor is it in the scope of this community. You may need to contact Yoothemes Support. – fischi Feb 18 '14 at 20:07
  • Thanks so much... :( If anybody knows the answer, would be great, since I can't afford the support from them at the moment... – Owl Feb 18 '14 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.