Esempio n. 1
0
function pw_get_element($pw_add_name, $pw_add_class = null)
{
    if ($pw_add_name == "maincontent") {
        $handle = pw_handles('Main Content');
        ?>
	    <li id="maincontent" role="main"<?php 
        if (!empty($class)) {
            echo ' class="' . $pw_add_class . '"';
        }
        ?>
> <!-- begin maincontent -->
    	<?php 
        echo $handle;
        if (!have_posts()) {
            pw_actionBlock('pw_404');
        } elseif (is_category()) {
            pw_actionBlock('pw_category');
        } elseif (is_author()) {
            pw_actionBlock('pw_author');
        } elseif (is_archive()) {
            pw_actionBlock('pw_archive');
        } elseif (is_search()) {
            pw_actionBlock('pw_search');
        } elseif (is_page()) {
            pw_actionBlock('pw_page');
            comments_template('', true);
        } elseif (is_single()) {
            pw_actionBlock('pw_single');
            comments_template('', true);
        } else {
            pw_actionBlock('pw_index');
        }
        ?>
    	</li> <!-- end #maincontent -->
    	<?php 
    }
    if ($pw_add_name == "firstsidebar") {
        pw_get_sidebar('firstsidebar', 'First Sidebar', 'pw_sidebar', $pw_add_class);
    }
    if ($pw_add_name == "secondsidebar") {
        pw_get_sidebar('secondsidebar', 'Second Sidebar', 'pw_second_sidebar', $pw_add_class);
    }
    if ($pw_add_name == "headerarea") {
        echo '<li id="headerarea" class="mainl" role="complementary">' . "\n";
        $handle = pw_handles('Widgetized Area', 'headerarea', true, 'header');
        echo $handle;
        if (!dynamic_sidebar("header-area") && current_user_can('edit_theme_options')) {
            echo '<div class="warning clear fl"><p>';
            printf(__("Add widgets to the Header Area %shere%s", "presswork"), '<a href="' . admin_url('widgets.php') . '">', '</a>');
            echo '</p></div>';
        }
        echo '</li>' . "\n";
    }
    if ($pw_add_name == "blogname") {
        $handle = pw_handles('Blog Name', 'blogname', true, 'header');
        ?>
	   	<li id="blogname" class="mainl">
            <?php 
        echo $handle;
        ?>
            <h1 id="site-title" class="siteheader"><a href="<?php 
        echo home_url();
        ?>
/"><?php 
        bloginfo('name');
        ?>
</a></h1>
        </li>
		<?php 
    }
    if ($pw_add_name == "header_logo") {
        $handle = pw_handles('Header Logo', 'header_logo', true, 'header');
        $logo = pw_theme_option("header_logo");
        if (!empty($logo)) {
            ?>
	   	<li id="header_logo" class="mainl">
            <?php 
            echo $handle;
            ?>
            <div id="site-logo" class="siteheader"><h1><?php 
            bloginfo('name');
            ?>
</h1><a href="<?php 
            echo home_url();
            ?>
/"><img src="<?php 
            echo $logo;
            ?>
" alt="<?php 
            bloginfo("name");
            ?>
" /></a></div>
        </li>
		<?php 
        }
    }
    if ($pw_add_name == "header_image") {
        $handle = pw_handles('Header Image', 'header_image', true, 'header');
        ?>
	   	<li id="header_image" class="mainl"><?php 
        echo $handle;
        ?>
</li>
		<?php 
    }
    if ($pw_add_name == "description") {
        $handle = pw_handles('Description', 'description', true, 'header');
        ?>
	   	<li id="description" class="mainl">
            <?php 
        echo $handle;
        ?>
	   		<?php 
        bloginfo('description');
        ?>
    	</li>
		<?php 
    }
    if ($pw_add_name == "nav") {
        $handle = pw_handles('Primary Nav Menu', 'nav', true, 'header');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="nav" class="mainl">';
            echo $handle;
            echo '<nav class="clear fl" role="navigation">';
            echo '<h3 class="assistive-text">Main menu</h3>';
            wp_nav_menu(array('theme_location' => 'primary', 'sort_column' => 'menu_order', 'container' => '', 'fallback_cb' => 'pw_menu_default'));
            echo '</nav>';
            echo '</li>';
        }
    }
    if ($pw_add_name == "subnav") {
        $handle = pw_handles('Secondary Nav Menu', 'subnav', true, 'header');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="subnav" class="mainl">';
            echo $handle;
            echo '<nav class="clear fl" role="navigation">';
            echo '<h3 class="assistive-text">Sub menu</h3>';
            wp_nav_menu(array('theme_location' => 'secondary', 'sort_column' => 'menu_order', 'container' => '', 'fallback_cb' => 'pw_sub_menu_default'));
            echo '</nav>';
            echo '</li>';
        }
    }
    if ($pw_add_name == "footernav") {
        $handle = pw_handles('Footer Nav Menu', 'footernav', true, 'footer');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="footernav" class="foot">';
            echo $handle;
            echo '<nav class="clear fl" role="navigation">';
            echo '<h3 class="assistive-text">Footer menu</h3>';
            wp_nav_menu(array('theme_location' => 'footer', 'sort_column' => 'menu_order', 'container' => '', 'fallback_cb' => 'pw_footer_menu_default'));
            echo '</nav>';
            echo '</li>';
        }
    }
    if ($pw_add_name == "extendedfooter") {
        $handle = pw_handles('Extended Footer', 'extendedfooter', true, 'footer');
        echo '<li id="extendedfooter" class="foot" role="complementary">';
        echo $handle;
        if (!dynamic_sidebar("extended-footer") && current_user_can('edit_theme_options')) {
            echo '<div class="warning clear fl"><p>';
            printf(__("Add widgets to the Extended Footer %shere%s", "presswork"), '<a href="' . admin_url('widgets.php') . '">', '</a>');
            echo '</p></div>';
        }
        echo '</li>';
    }
    if ($pw_add_name == "copyright") {
        $handle = pw_handles('Copyright', 'copyright', true, 'footer');
        echo '<li id="copyright" class="foot">';
        echo $handle;
        $link = '<a href="' . home_url() . '">' . get_bloginfo('name') . '</a>';
        printf(__('&copy; %1$d %2$s. All Rights Reserved.', "presswork"), date('Y'), $link);
        echo ' ';
        printf(__('Created using %s.', "presswork"), '<a href="http://presswork.me">PressWork</a>');
        echo '</li>';
    }
    do_action('add_pw_get_element', $pw_add_name, $pw_add_class);
}
Esempio n. 2
0
function pw_get_element($name)
{
    if ($name == "maincontent") {
        $handle = pw_handles('Main Content');
        ?>
	    <li id="maincontent"> <!-- begin maincontent -->
    	<?php 
        echo $handle;
        if (!have_posts()) {
            actionBlock('pw_404');
        } elseif (is_category()) {
            actionBlock('pw_category');
        } elseif (is_author()) {
            actionBlock('pw_author');
        } elseif (is_archive()) {
            actionBlock('pw_archive');
        } elseif (is_search()) {
            actionBlock('pw_search');
        } elseif (is_page()) {
            actionBlock('pw_page');
            comments_template('', true);
        } elseif (is_single()) {
            actionBlock('pw_single');
            comments_template('', true);
        } else {
            actionBlock('pw_index');
        }
        ?>
    	</li> <!-- end #maincontent -->
    	<?php 
    }
    if ($name == "firstsidebar") {
        pw_get_sidebar('firstsidebar', 'First Sidebar', 'pw_sidebar');
    }
    if ($name == "secondsidebar") {
        pw_get_sidebar('secondsidebar', 'Second Sidebar', 'pw_second_sidebar');
    }
    if ($name == "headerarea") {
        echo '<li id="headerarea" class="mainl">' . "\n";
        $handle = pw_handles('Widgetized Area', 'headerarea', true, 'header');
        echo $handle;
        if (!dynamic_sidebar("header-area")) {
            echo '<div class="warning clear fl"><p>' . __("Add widgets to the Header Area ", "presswork") . '<a href="' . admin_url('widgets.php') . '">' . __("here", "presswork") . '</a>.</p></div>';
        }
        echo '</li>' . "\n";
    }
    if ($name == "blogname") {
        $handle = pw_handles('Blog Name', 'blogname', true, 'header');
        ?>
	   	<li id="blogname" class="mainl">
            <?php 
        echo $handle;
        ?>
            <?php 
        if (is_home()) {
            $header = "h1";
        } else {
            $header = "div";
        }
        ?>
            <?php 
        echo "<" . $header;
        ?>
 class="siteheader"><a href="<?php 
        echo home_url();
        ?>
/"><?php 
        bloginfo('name');
        ?>
</a></<?php 
        echo $header;
        ?>
>
        </li>
		<?php 
    }
    if ($name == "header_logo") {
        $handle = pw_handles('Header Logo', 'header_logo', true, 'header');
        ?>
	   	<li id="header_logo" class="mainl">
            <?php 
        echo $handle;
        ?>
            <div class="siteheader"><a href="<?php 
        echo home_url();
        ?>
/"><img src="<?php 
        echo theme_option("header_logo");
        ?>
" alt="<?php 
        bloginfo("name");
        ?>
" /></a></div>
        </li>
		<?php 
    }
    if ($name == "description") {
        $handle = pw_handles('Description', 'description', true, 'header');
        ?>
	   	<li id="description" class="mainl">
            <?php 
        echo $handle;
        ?>
	   		<?php 
        bloginfo('description');
        ?>
    	</li>
		<?php 
    }
    if ($name == "nav") {
        $handle = pw_handles('Nav Menu', 'nav', true, 'header');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="nav" class="mainl">';
            echo $handle;
            wp_nav_menu(array('theme_location' => 'main', 'menu_class' => 'sf-menu', 'sort_column' => 'menu_order', 'container' => 'nav', 'container_class' => 'clear fl', 'fallback_cb' => 'menu_default'));
            echo '</li>';
        }
    }
    if ($name == "subnav") {
        $handle = pw_handles('Sub Nav Menu', 'subnav', true, 'header');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="subnav" class="mainl">';
            echo $handle;
            wp_nav_menu(array('theme_location' => 'sub', 'menu_class' => 'sf-menu', 'sort_column' => 'menu_order', 'container' => 'nav', 'container_class' => 'clear fl', 'fallback_cb' => 'sub_menu_default'));
            echo '</li>';
        }
    }
    if ($name == "footernav") {
        $handle = pw_handles('Footer Nav Menu', 'footernav', true, 'footer');
        if (function_exists('wp_nav_menu')) {
            echo '<li id="footernav" class="foot">';
            echo $handle;
            wp_nav_menu(array('theme_location' => 'footer', 'menu_class' => 'sf-menu', 'sort_column' => 'menu_order', 'container' => 'nav', 'container_class' => 'clear fl', 'fallback_cb' => 'footer_menu_default'));
            echo '</li>';
        }
    }
    if ($name == "extendedfooter") {
        $handle = pw_handles('Extended Footer', 'extendedfooter', true, 'footer');
        echo '<li id="extendedfooter" class="foot">';
        echo $handle;
        if (!dynamic_sidebar("extended-footer")) {
            echo '<div class="warning clear fl"><p>' . __("Add widgets to the Extended Footer ", "presswork") . '<a href="' . admin_url('widgets.php') . '">' . __("here", "presswork") . '</a>.</p></div>';
        }
        echo '</li>';
    }
    if ($name == "copyright") {
        $handle = pw_handles('Copyright', 'copyright', true, 'footer');
        echo '<li id="copyright" class="foot">';
        echo $handle;
        $link = '<a href="' . home_url() . '">' . get_bloginfo('name') . '</a>';
        printf(__('&copy; %1$d %2$s. All Rights Reserved.', "presswork"), date('Y'), $link);
        echo ' ';
        printf(__('Built using %s.', "presswork"), '<a href="http://presswork.me">' . THEME_NAME . '</a>');
        echo '</li>';
    }
}