/** * Adds action calls * * @since PressWork 1.0 */ function pw_actionCall($id) { if (pw_theme_option('toolbox') == "on" && pw_theme_option('hooks') == "on" && current_user_can('edit_theme_options')) { echo '<div class="hooks clear fl"><p class="hooks-title">' . $id . '</p>'; } do_action($id); if (pw_theme_option('toolbox') == "on" && pw_theme_option('hooks') == "on" && current_user_can('edit_theme_options')) { echo '</div>'; } }
function pw_footer_content() { echo pw_function_handle(__FUNCTION__); ?> <ul id="footer" class="clearfix"> <?php $layout = pw_theme_option('footer_option'); $layout = explode(",", $layout); foreach ($layout as $elem) { pw_get_element($elem); } ?> </ul> <!-- end #footer --> <?php }
/** * Add slideshow functionality * * Displays a slideshow according to the parameters set in the argument array. * * @since PressWork 1.0 */ function pw_slideshow($args = '') { global $wp_scripts; $defaults = array('type' => 'scrollerota', 'cat' => '', 'postnum' => 4, 'width' => pw_theme_option('content_width'), 'height' => 260, 'excerpt' => 35); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); $name = $r['type']; $wp_scripts->in_footer[] = 'pw_' . $name . '_js'; $wp_scripts->queue[] = 'pw_' . $name . '_js'; $wp_scripts->groups['pw_' . $name . '_js'] = 1; if (!empty($r['cat'])) { $featuredcat = $r['cat']; $posts = array("posts_per_page" => $r['postnum'], "cat" => $featuredcat, "ignore_sticky_posts" => 1); } else { $posts = array("posts_per_page" => $r['postnum'], "ignore_sticky_posts" => 1); } $featured = new WP_Query(); $featured->query($posts); ?> <div id="<?php echo $r['type']; ?> " class="pw-slideshow" style="height: <?php echo $r['height']; ?> px;"> <div class="slideshow-content" style="height: <?php echo $r['height']; ?> px;"> <ul class="images"> <?php while ($featured->have_posts()) { $featured->the_post(); ?> <li> <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { echo '<a href="' . get_permalink() . '">'; the_post_thumbnail('full'); echo '</a>'; } ?> </li> <?php } ?> </ul> <ul class="text"> <?php while ($featured->have_posts()) { $featured->the_post(); ?> <li> <?php if ($r['type'] == "faderota") { echo '<header><h4><a href="' . get_permalink() . '">' . esc_attr(get_the_title()) . '</a></h4></header>'; } else { echo '<header><h4><a href="' . get_permalink() . '">' . esc_attr(get_the_title()) . '</a></h4></header>'; echo pw_excerpt($r['excerpt']); ?> <footer><a href="<?php the_permalink(); ?> " class="readmore"><?php _e('Read more', "presswork"); ?> </a></footer> <?php } ?> </li> <?php } ?> </ul> </div><!-- end .slideshow-content --> </div><!-- end #slideshow --> <?php }
function pw_social_option($name, $text, $placeholder) { echo '<tr><th>' . $text . '</th><td><input type="text" placeholder="' . $placeholder . '" name="' . $name . '" value="' . pw_theme_option($name) . '" /></td></tr>'; }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'type' => 'scrollerota', 'postnum' => '4', 'width' => pw_theme_option('content_width'), 'height' => 260, 'cat' => '', 'excerpt' => 35)); $title = strip_tags($instance['title']); $type = strip_tags($instance['type']); $postnum = strip_tags($instance['postnum']); $width = strip_tags($instance['width']); $height = strip_tags($instance['height']); $cat = strip_tags($instance['cat']); $excerpt = strip_tags($instance['excerpt']); $selectname = $this->get_field_name('cat'); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', "presswork"); ?> : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('type'); ?> "><?php _e('Type', "presswork"); ?> : <select id="<?php echo $this->get_field_id('type'); ?> " name="<?php echo $this->get_field_name('type'); ?> "> <option class="level-0" value="faderota" <?php selected($type, "faderota"); ?> >Fade</option> <option class="level-0" value="scrollerota" <?php selected($type, "scrollerota"); ?> >Scroll</option> <option class="level-0" value="sliderota" <?php selected($type, "sliderota"); ?> >Slide</option> </select> </label></p> <p><label for="<?php echo $this->get_field_id('postnum'); ?> "><?php _e('Number of posts', "presswork"); ?> : <input class="widefat" id="<?php echo $this->get_field_id('postnum'); ?> " name="<?php echo $this->get_field_name('postnum'); ?> " type="text" value="<?php echo esc_attr($postnum); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('width'); ?> "><?php _e('Width', "presswork"); ?> : <input class="widefat" id="<?php echo $this->get_field_id('width'); ?> " name="<?php echo $this->get_field_name('width'); ?> " type="text" value="<?php echo esc_attr($width); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('height'); ?> "><?php _e('Height', "presswork"); ?> : <input class="widefat" id="<?php echo $this->get_field_id('height'); ?> " name="<?php echo $this->get_field_name('height'); ?> " type="text" value="<?php echo esc_attr($height); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('excerpt'); ?> "><?php _e('Excerpt length', "presswork"); ?> : <input class="widefat" id="<?php echo $this->get_field_id('excerpt'); ?> " name="<?php echo $this->get_field_name('excerpt'); ?> " type="text" value="<?php echo esc_attr($excerpt); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('cat'); ?> "><?php _e('Category', "presswork"); ?> : <?php wp_dropdown_categories('show_option_all=All&hide_empty=0&name=' . $selectname . '&selected=' . $cat); ?> </label></p> <?php }
function pw_header_css() { global $pw_content_width, $pw_first_sidebar, $pw_second_sidebar, $pw_body_margins, $pw_margins, $pw_site; $fullsite = $pw_site; $mainlineheight = round(pw_theme_option('main_size') * 1.4); $right_col_padding = get_option('thumbnail_size_w') + 15; ?> <!-- PressWork Theme Option CSS --> <style type="text/css"<?php if (pw_theme_option('toolbox') == "on" && current_user_can("edit_theme_options")) { echo ' id="pw_style_preview"'; } ?> > body { font-family: <?php echo pw_theme_option("body_font"); ?> ; font-size: <?php echo pw_theme_option("body_font_size"); ?> px; } h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { font-family: <?php echo pw_theme_option("headers_font"); ?> ; } #body-wrapper { color: <?php echo pw_theme_option('main_text_color'); ?> ; width: <?php echo $pw_site; ?> px; padding: <?php echo $pw_body_margins; ?> px; background-color: <?php echo pw_theme_option('page_background_color'); ?> ; } #headerbanner, #footer { width: <?php echo $pw_site; ?> px; } #headerbanner li.mainl#header_image { background-size: <?php echo $pw_site; ?> px; } #main-wrapper > li { margin: 0 <?php echo $pw_margins / 2; ?> px; } #main-wrapper .el3 { *margin-left: <?php echo $pw_margins; ?> px; } #firstsidebar { width: <?php echo $pw_first_sidebar; ?> px; } #secondsidebar { width: <?php echo $pw_second_sidebar; ?> px; } #maincontent { width: <?php echo $pw_content_width; ?> px; } body.fullwidth #maincontent { width: <?php echo $fullsite; ?> px; } .siteheader a { color: <?php echo pw_theme_option('siteheader_color'); ?> ; } .siteheader a:hover { color: <?php echo pw_theme_option('siteheader_color_hover'); ?> ; } #description { color: <?php echo pw_theme_option('description_color'); ?> ; } a { color: <?php echo pw_theme_option('a_color'); ?> ; } a:hover { color: <?php echo pw_theme_option('a_color_hover'); ?> ; } #nav nav ul { background: <?php echo pw_theme_option('nav_background_color'); ?> ; } #nav nav a { color: <?php echo pw_theme_option('nav_color'); ?> } #nav nav a:hover, #nav nav .sub-menu li, #nav nav li:hover { color: <?php echo pw_theme_option('nav_color_hover'); ?> ; background: <?php echo pw_theme_option('nav_background_color_hover'); ?> ; } #subnav nav ul { background: <?php echo pw_theme_option('subnav_background_color'); ?> ; } #subnav nav a { color: <?php echo pw_theme_option('subnav_color'); ?> } #subnav nav a:hover, #subnav nav .sub-menu li, #subnav nav li:hover { color: <?php echo pw_theme_option('subnav_color_hover'); ?> ; background: <?php echo pw_theme_option('subnav_background_color_hover'); ?> ; } #footer nav ul { background: <?php echo pw_theme_option('footernav_background_color'); ?> ; } #footer nav a { color: <?php echo pw_theme_option('footernav_color'); ?> } #footer nav a:hover, #footer nav .sub-menu li, #footer nav li:hover { color: <?php echo pw_theme_option('footernav_color_hover'); ?> ; background: <?php echo pw_theme_option('footernav_background_color_hover'); ?> ; } h1.catheader { color: <?php echo pw_theme_option('category_header_color'); ?> ; } article .meta { color: <?php echo pw_theme_option('post_meta_color'); ?> ; } article .posttitle, article .posttitle a { color: <?php echo pw_theme_option('post_title_color'); ?> ; } article .posttitle a:hover { color: <?php echo pw_theme_option('post_title_color_hover'); ?> ; } article .content-col { padding-left: <?php echo $right_col_padding; ?> px; } <?php do_action("pw_media_queries"); ?> </style> <!-- eof PressWork Theme Option CSS --> <?php }
function pw_footer_scripts() { echo "\n<!-- PressWork Toolbox Scripts -->"; ?> <script type="text/javascript"> /* <![CDATA[ */ (function($) { <?php global $pw_welcome; if (!empty($_GET['action']) && $_GET['action'] == "pw-activate" && empty($pw_welcome)) { ?> $("#close-welcome").click(function() { var nonce = $("input#presswork_nonce").val(), data = { nonce: nonce, action: 'remove_welcome_screen' }; $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ $("#pw_welcome_screen, #pw_fadeback").fadeOut("slow", function() { window.location = "<?php echo home_url("/"); ?> "; }); }); }); $(document).ready(function() { var pos = $("#wp-admin-bar-presswork-options").position(); if(!pos) pos = $("#wp-admin-bar-presswork-menu").position(); $(".adminbar-arrow").css({ left: pos.left-30 }).show(); }); <?php } ?> $("#savetheme").click(function() { $("#themeform").trigger("submit"); $(this).removeClass("remember"); return false; }); $("#themeform").submit(function() { var nonce = $("input#presswork_nonce").val(), loader = $("#ajaxloader"), message = $("#save_message"), data = { action: 'save_theme_options', nonce: nonce, option: $(this).serialize(), }; message.hide(); loader.show(); $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ loader.hide(); message.fadeIn(); setTimeout(function() { message.fadeOut(); }, 5000); }); return false; }); $("#colorselect").change(function() { colorselect(); }); $("#layoutselect").change(function() { layoutselect(); }); $( '.font-select a' ).click(function() { var section_to_show = $(this).next(), already_visible = $( '.font-preview:visible' ); section_to_show.slideToggle( 'slow' ); already_visible.slideUp( 'slow' ); }); $(".font-preview a").bind({ click: function(){ var el = $(this), fontSelect = el.parents( '.font-select' ), fontPreview = el.parents( '.font-preview' ), thisText = el.text(); fontSelect .children( 'a.current' ).text(thisText).css( 'font-family', thisText) .end() .children( 'input' ).val(thisText); fontPreview .children( 'a.selected' ).removeClass( 'selected' ) .end() .parents( '.font-preview' ).slideUp( 'slow' ); el.addClass( 'selected' ); }, mouseenter: function(){ var el = $(this), to_style = el.parents( '.font-select' ).children( 'a.current' ).data("pw-selectors"), this_font = el.text(); //console.log( 'to_style: ' + to_style + ', this_font: ' + this_font); if(!el.parent( '.font-preview' ).is( ':animated' )) $(to_style).css({ fontFamily : this_font }); }, mouseleave: function(){ var el = $(this), current = el.parents( '.font-select' ).children( 'a.current' ), to_style = current.data("pw-selectors"), original_option = current.text(); // console.log( 'to_style: ' + to_style + ', original_option: ' + original_option); if(!el.parent( '.font-preview' ).is( ':animated' )) $(to_style).css({ fontFamily : original_option}); } }); $("#the_header_logo").change(function() { $("#header_logo img").attr("src", $(this).val()); }); function colorselect() { $(".color-item").show().not("." + $("#colorselect").val() + "-item").hide(); } colorselect(); function layoutselect() { var value = $("#layoutselect").val(); $(".addoption").show().not("."+value+"-item").hide(); $("."+value+"-inputs").show(); $(".pw-inputs").not("."+value+"-inputs").hide(); } layoutselect(); if($(".colorpicker").val()=="") $(".colorpicker").val("#") var f = $.farbtastic( '#picker' ); $( '.colorpicker' ) .each(function() { f.linkTo(this); }) .focus(function() { f.linkTo(this); }) .change(function() { if($(this).val()=="") $(this).val("#"); change_styles(); }); $(".farbtastic").mouseup(function() { change_styles(); $("#savetheme").addClass("remember"); }); function change_styles() { $(".colorpicker:visible").each(function() { var el = $(this), col = el.val(), style = el.data("pw-selectors").split( '|' ), addstyle = style[0] + " { " + style[1] + ": " + col + "; }\n"; $("#pw_style_preview").append(addstyle); }); } $("#body_font_size").change(function() { var size = $(this).val(); $( 'body' ).css("font-size", size+"px"); }); $(".add-item").click(function(){ var el = $(this); if(el.hasClass("disabled")) { // nothing } else { el.addClass("disabled"); var nonce = $("input#presswork_nonce").val(), loader = $("#ajaxloader"), wrap = el.data("pw-selectors").split("|"), main = $("#"+wrap[0]), item = el.data("pw-ids"), data = { action: 'add_element', element: item, option: wrap[1], nonce: nonce, }; loader.show(); $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ loader.hide(); if(response) { main.append(response); if(wrap[1]=="layout") { var last = main.find("li#"+item), newfull = parseInt($( '.layout_widths[data-pw-ids="'+item+'"]' ).val()), contentMargins = parseInt($( '#content_margins' ).val()), bodyWrapper = $("#body-wrapper"), full = bodyWrapper.width(), total_new = full + newfull + contentMargins; last.css({ margin: "0 "+contentMargins/2+"px", width: newfull }); $("body").removeClass("fullwidth"); bodyWrapper.stop(true,true).animate({ width: total_new }, function() { last.show(); }); $("#headerbanner, #footer").animate({ width: total_new }); $("#header_image").animate({ backgroundSize: total_new }); } $("#"+wrap[1]+"_option").val( main.sortable("toArray") ); $("#savetheme").addClass("remember"); } }); } }); $(".save_option").click(function() { if($(this).hasClass("active")) { var value = "off"; } else { var value = "on"; } var theID = $(this).attr("id"), loader = $("#ajaxloader"), data = { action: 'save_option', option: value, id: theID }; loader.show(); $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ setTimeout(function() { location.reload(); }, 1000); }); }); $("#reset_options").click(function() { var message = "Are you sure you want to reset the theme options?"; if(confirm(message)) { var loader = $("#ajaxloader"), data = { action: 'reset_theme_options' }; loader.show(); $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ setTimeout(function() { location.reload(); }, 1000); }); } else { return false; } }); $(".layout_widths").change(function(){ var value = $(this).val(), id = $(this).data("pw-ids"), current = $("#"+id).width(), bodyWrapper = $("#body-wrapper"), headerFooter = $("#headerbanner, #footer"), headerImage = $("#header_image"), full = bodyWrapper.width(), newfull = parseInt(full) - parseInt(current) + parseInt(value); if(value>current) { bodyWrapper.stop(true,true).animate({ width: newfull }, function() { $("#"+id).stop(true,true).animate({ width: value }); headerFooter.animate({ width: newfull }); headerImage.animate({ backgroundSize: newfull }); }); } else { $("#"+id).stop(true,true).animate({ width: value }, function() { bodyWrapper.stop(true,true).animate({ width: newfull }); headerFooter.animate({ width: newfull }); headerImage.animate({ backgroundSize: newfull }); }); } }); $(".margins").change(function(){ var value = $(this).val(), id = $(this).data("pw-ids"); if(id!="body-wrapper") { var bodyWrapper = $("#body-wrapper"), headerFooter = $("#headerbanner, #footer"), headerImage = $("#header_image"), current = $("#"+id).css("margin-right").replace("px", ""), full = bodyWrapper.width(), n = $("#"+id).length-1, newfull = parseInt(full) - (parseInt(current*2)* n) + (parseInt(value)* n), newvalue = "0 " + (value/2); if((value/2)>current) { bodyWrapper.stop(true,true).animate({ width: newfull }, function() { $("#"+id).css({ margin: newvalue+"px" }); }); } else { $("#"+id).css({ margin: newvalue+"px" }); bodyWrapper.stop(true,true).animate({ width: newfull }); } headerFooter.animate({ width: newfull }); headerImage.animate({ backgroundSize: newfull }); } else { $("#"+id).css({ padding: value+"px" }); } }); $("#social .themeoptions input").change(function() { var value = $(this).val(), el = $(this).attr( 'name' ); if(value=='' ) { $("#social-icons a."+el+"-icon").remove(); } else if($("#social-icons a."+el+"-icon").length==0) { var theURL; if(el=="twitter") theURL = "http://twitter.com/"+value; if(el=="facebook") theURL = "http://facebook.com/"+value; if(el=="flickr") theURL = "http://flickr.com/photos/"+value; if(el=="linkedin") theURL = "http://www.linkedin.com/in/"+value; if(el=="stumbleupon") theURL = "http://www.stumbleupon.com/stumbler/"+value; if(el=="googleplus") theURL = "https://plus.google.com/"+value; $("#social-icons").append("<a href='"+theURL+"' class='"+el+"-icon'></a>"); } }); $(".open_toolbox").click(function() { var button = $(this), it = $(this).data("pw-toolbox-name"), par = $("#"+it); if(button.hasClass("open")) { par.stop(true,true).fadeOut( 'fast' ); button.removeClass("open"); return; } $(".open_toolbox").removeClass("open"); button.addClass("open"); if($(".pw_toolbox_content").not(par).is(".open")) { $(".pw_toolbox_content.open").fadeOut( 'fast', function() { if(!par.hasClass("open")) par.stop(true,true).fadeIn().addClass("open"); }).removeClass("open"); } else { par.stop(true,true).fadeIn().addClass("open"); } }); $(".closewindow").click(function() { $(".pw_toolbox_content").fadeOut( 'fast' ); $(".open_toolbox").removeClass("open"); }); <?php if (pw_theme_option("dragdrop") == "on") { ?> $(".delete_element").live("click", function(){ var nonce = $("input#presswork_nonce").val(), loader = $("#ajaxloader"), main = $("#main-wrapper"), el = $(this), element = $(this).data("pw-ids"), option = $(this).data("pw-selectors"), data = { action: 'delete_element', element: element, option: option, nonce: nonce, }; loader.show(); $( '.add-item[data-pw-ids="'+element+'"]' ).removeClass("disabled"); $.post( '<?php echo admin_url('admin-ajax.php'); ?> ', data, function(response){ loader.hide(); if(option=="layout_option") { var theitem = el.parent().parent(), newfull = theitem.width(), bodyWrapper = $("#body-wrapper"), full = bodyWrapper.width(), new_width = full - newfull - parseInt($( '#content_margins' ).val()); theitem.remove(); $("#header_image").animate({ backgroundSize: new_width }); bodyWrapper.stop(true,true).animate({ width: new_width }, function() { $("#headerbanner, #footer").css({ width: new_width }); }); var parent = "main-wrapper"; } if(option=="header_option") { var theitem = el.parent().parent(), parent = "headerbanner"; theitem.remove(); } if(option=="footer_option") { var theitem = el.parent().parent(), parent = "footer"; theitem.remove(); } $("#"+option).val( $("#"+parent).sortable("toArray") ); $("#savetheme").addClass("remember"); }); }); <?php } ?> $("#main-wrapper") .sortable({ placeholder: 'placeholder', handle: "div.handle", forcePlaceholderSize: true, update: function(){ $("#layout_option").val( $(this).sortable("toArray") ); } }) $("#headerbanner") .sortable({ placeholder: 'placeholder', handle: "div.handle", forcePlaceholderSize: true, update: function(){ $("#header_option").val( $(this).sortable("toArray") ); } }) $("#footer") .sortable({ placeholder: 'placeholder', handle: "div.handle", forcePlaceholderSize: true, update: function(){ $("#footer_option").val( $(this).sortable("toArray") ); } }) $("#themeform input, #themeform #fonts select").change(function() { $("#savetheme").addClass("remember"); }); // ask the user to confirm the window closing window.onbeforeunload = function() { if($( '#savetheme' ).hasClass("remember")) { return "<?php _e("If you leave this page you will lose your changes.", "presswork"); ?> "; } } })(jQuery); /* ]]> */ </script> <!-- eof PressWork Toolbox Scripts --> <?php }
?> </title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?> " type="text/css" media="screen" /> <?php pw_header_css(); ?> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?> " /> <?php $favicon = pw_theme_option('favicon'); if (!empty($favicon)) { echo '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '" />' . "\n"; } ?> <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width" /> <?php wp_head(); ?> </head> <!--[if lt IE 7 ]> <body <?php body_class("ie6"); ?>
/** * The main template file. * * This is the most generic template file in a WordPress theme * and one of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query. * E.g., it puts together the home page when no home.php file exists. * Learn more: http://codex.wordpress.org/Template_Hierarchy * * Calls pw_get_element() to display elements according to how they have * been placed using the drag and drop function. * * @since PressWork 1.0 */ get_header(); ?> <?php $layout = pw_theme_option('layout_option'); if (is_singular()) { $fullwidth = get_post_meta($post->ID, 'pw_single_layout', true); if ($fullwidth == 2) { $layout = "maincontent"; } } $layout = explode(",", $layout); $i = 1; foreach ($layout as $elem) { pw_get_element($elem, "el" . $i); $i++; } get_footer();
/** * Add pw_columns functionality * * Display posts in a grid layout according to the parameters set in the * argument array. * * @since PressWork 1.0 */ function pw_columns($args = '') { global $pw_content_width, $paged; $defaults = array('width' => 'full', 'columns' => 1, 'posts' => 1, 'text' => 'excerpt', 'excerpt_length' => 55, 'readmore' => 1, 'category' => 0, 'dates' => 1, 'authors' => 1, 'comments' => 1, 'images' => 1, 'img_w' => 100, 'img_h' => 100, 'img_float' => 'alignright', 'margin_right' => '', 'offset' => '', 'title' => '', 'id' => '', 'padding' => 0, 'colmargin' => 30, 'container_width' => ''); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); $content_width = empty($r['container_width']) ? $pw_content_width : $r['container_width']; $featuredcat = pw_theme_option('fp_featured'); $post_query = array("posts_per_page" => $r['posts'], "ignore_sticky_posts" => 1, 'paged' => $paged); if ($r['category'] != 0) { $post_query['cat'] = $r['category']; } if (!empty($r['offset'])) { $post_query['offset'] = $r['offset']; } if ($r['width'] == "full") { $width = ' style="width:100%;'; if (!empty($r['margin_right'])) { $width .= ' margin-right:' . $r['margin_right'] . 'px;"'; } else { $width .= '"'; } if ($r['columns'] != 1) { $col_width = ($content_width - $colmargin * ($columns - 1)) / $r['columns']; $col_width = ' style="width: ' . $col_width . 'px;'; } else { $col_width = ' style="width: 100%'; } } else { $width = ' style="width:' . $r['width'] . 'px; margin-right:' . $r['margin_right'] . 'px;"'; if ($r['columns'] != 1) { $col_width = ($r['width'] - $colmargin * ($columns - 1)) / $r['columns']; } else { $col_width = $r['width']; } $col_width = ' style="width: ' . $col_width . 'px;'; } if (!empty($padding)) { $col_width .= ' padding: ' . $padding . 'px;'; } $x = 1; if (!empty($r['id'])) { $id = ' id="' . $r['id'] . '"'; } else { $id = ""; } $column_query = new WP_Query(); $column_query->query($post_query); ?> <div class="columns"<?php echo $width; echo $id; ?> > <?php while ($column_query->have_posts()) { $column_query->the_post(); ?> <?php if ($x == 1) { $clear = "clear"; } else { $clear = ""; } ?> <?php if ($x != 1 && $r['columns'] > 1) { $final_width = $col_width . ' margin-left: ' . $colmargin . 'px;"'; } else { $final_width = $col_width . '"'; } ?> <?php if ($x == $r['columns']) { $x = 0; } ?> <article id="post-<?php the_ID(); ?> " <?php post_class($clear); echo $final_width; ?> > <?php pw_actionBlock('pw_columns', $r); ?> </article> <?php $x++; } ?> </div> <?php }
function pw_add_all_elements() { ?> <?php pw_add_element_option('header', 'header_logo', __('Logo', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'header_image', __('Header Image', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'blogname', __('Blog Name', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'description', __('Description', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'nav', __('Primary Menu', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'subnav', __('Secondary Menu', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('header', 'headerarea', __('Widgetized Area', "presswork"), 'headerbanner|header'); ?> <?php pw_add_element_option('layout', 'firstsidebar', __('First Sidebar', "presswork"), 'main-wrapper|layout'); ?> <?php pw_add_element_option('layout', 'secondsidebar', __('Second Sidebar', "presswork"), 'main-wrapper|layout'); ?> <?php pw_add_element_option('footer', 'footernav', __('Footer Menu', "presswork"), 'footer|footer'); ?> <?php pw_add_element_option('footer', 'extendedfooter', __('Extended Footer', "presswork"), 'footer|footer'); ?> <?php pw_add_element_option('footer', 'copyright', __('Copyright', "presswork"), 'footer|footer'); ?> <table class="pw-inputs header-inputs"> <tr><td><label for="the_header_logo"><?php _e('Logo Image URL', "presswork"); ?> </label></td><td><input type="text" name="header_logo" id="the_header_logo" class="header-item" value="<?php echo pw_theme_option("header_logo"); ?> " /></td></tr> <tr><td><label for="favicon"><?php _e('Favicon URL', "presswork"); ?> </label></td><td><input type="text" name="favicon" id="favicon" value="<?php echo pw_theme_option("favicon"); ?> " /></td></tr> </table> <?php }
/** * Adds the fullwidth class to the body tag * * @since PressWork 1.0 */ function pw_fullWidth($classes = '') { global $post; $added = ''; if (!empty($post)) { $full = get_post_meta($post->ID, 'pw_single_layout', true); if ($full == 2 && is_singular()) { $classes[] = 'fullwidth'; $added = true; } } if (pw_theme_option('layout_option') == "maincontent" && empty($added)) { $classes[] = 'fullwidth'; } return $classes; }