If you are using the Wppizza search widget WP -> Appearance -> Widgets -> WPPizza Type:Search or search widget shortcode you will most probably want to create a dedicated search template that works with your theme instead of using the default as this would not display any prices and other wppizza related elements on results that include wppizza menu items (products)
To do so , please follow the documentation regarding setting up the search.php template
]]>Only really used/needed if using WPPizza search widget with wppizza menu items enabled or equivalent shortcode
NOTE: although the following would work the same way with your normal/main theme the below assumes you are using a child theme. If you are not using a child theme, now would be a good time to create one to allow you to update your main theme when an update becomes available without loosing any of your changes or additions you make now or in the future. If you do not know how to create a child theme or why to use one, please refer to the wordpress codex here.
How to:
wppizza/markup/search so your whole structure will look something like this /[path]/[to]/[my]/[child-theme]/wppizza/markup/search/[path]/[to]/[my]/[child-theme]/wppizza/markup/search/search.phpwhile ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'search' );
endwhile;
get_template_part( 'template-parts/content', 'search' );
with
if(function_exists('wppizza_search_results_get_template_part')){
wppizza_search_results_get_template_part('template-parts/content', 'search' );
}else{
get_template_part( 'template-parts/content', 'search' );
}
leaving any codeblocks before and after intact and save
<?php
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentysixteen' ), '<span>' . esc_html( get_search_query() ) . '</span>' ); ?></h1>
</header><!-- .page-header -->
<?php
// Start the loop.
while ( have_posts() ) : the_post();
if(function_exists('wppizza_search_results_get_template_part')){
wppizza_search_results_get_template_part('template-parts/content', 'search' );
}else{
get_template_part( 'template-parts/content', 'search' );
}
// End the loop.
endwhile;
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'twentysixteen' ),
'next_text' => __( 'Next page', 'twentysixteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
) );
// If no content, include the "No posts found" template.
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</main><!-- .site-main -->
</section><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
get_template_part( 'abcdef', 'xyz' );
replace it with
if(function_exists('wppizza_search_results_get_template_part')){
wppizza_search_results_get_template_part('abcdef', 'xyz' );
}else{
get_template_part( 'abcdef', 'xyz' );
}
Quick summary:
/[your]/[path]/[to]/wp-content/themes/my-theme/search.php TO /[your]/[path]/[to]/wp-content/themes/[my-child-theme]/wppizza/markup/search/search.php
# - codeblock to replace - #
while ( have_posts() ) : the_post();
get_template_part( 'abcdef', 'xyz' );
endwhile;
# - codeblock to replace end - #
width
# - codeblock replace with - #
if(function_exists('wppizza_search_results_get_template_part')){
wppizza_search_results_get_template_part('abcdef', 'xyz' );
}else{
get_template_part( 'abcdef', 'xyz' );
}
# - codeblock replace with end - #
Additional Notes:
The output generated is in fact a shortcode like so : echo do_shortcode("[wppizza single='9' showadditives='0']"); (where ‘9’ would be the appropriate post_id)
The arguments of which are filterable if you want , using ‘wppizza_filter_single_post_arguments’ hook like so
add_filter('wppizza_filter_single_post_arguments', 'myprefix_filter_single_wppizza_items', 10, 2);
function myprefix_allow_comments_for_single_wppizza_items($args, $terms){
/ - customise arguments as required -/
return $args;
}
See wppizza shortcode documentation as to what arguments exist for single items and/or wordpress codex about how to use filters if you are unfimiliar with filter hooks
]]>If you are using/displaying permalinks in your list of menu items by using the relevant shortcode and/or are using the Wppizza search widget WP -> Appearance -> Widgets -> WPPizza Type:Search or search widget shortcode you will most probably want to create a single item template that works with your theme instead of using the default (as this would not display any prices and other wppizza related elements)
To do so , please follow the documentation regarding setting up the single.php template
]]>Only really used/needed if using WPPizza search widget with wppizza menu items enabled or including "permalink" in elements attributes of shortcode.
NOTE: although the below would work the same way with your normal/main theme the below assumes you are using a child theme. If you are not using a child theme, now would be a good time to create one to allow you to update your main theme when an update becomes available without loosing any of your changes or additions you make now or in the future. If you do not know how to create a child theme or why to use one, please refer to the wordpress codex here.
How to:
wppizza/markup/single so your whole structure will look something like this /[path]/[to]/[my]/[child-theme]/wppizza/markup/single/[path]/[to]/[my]/[child-theme]/wppizza/markup/single/single.php
while ( have_posts() ) : the_post();
if(is_single()){
.....
}
endwhile;
echo $do_single;, leaving any codeblocks before and after intact and save<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php echo $do_single; ?>
</main><!-- .site-main -->
<?php get_sidebar( 'content-bottom' ); ?>
</div><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
echo $do_single;.
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
// Previous/next post navigation.
the_post_navigation( array(
'next_text' => ' ' .
'' . __( 'Next post:', 'theme_name' ) . ' ' .
'%title',
'prev_text' => ' ' .
'' . __( 'Previous post:', 'theme_name' ) . ' ' .
'%title',
) );
If your theme’s single.php template is somewhat more complicated, find below a “before” and “after” example (using the “Kale” wordpress theme here) which should get you an idea how to make this work for your particular theme. Adjust as required of course:
<?php
/**
* The template for displaying posts
*
* @package kale
*/
?>
<?php get_header(); ?>
<?php
$kale_posts_meta_show = kale_get_option('kale_posts_meta_show');
$kale_posts_date_show = kale_get_option('kale_posts_date_show');
$kale_posts_category_show = kale_get_option('kale_posts_category_show');
$kale_posts_author_show = kale_get_option('kale_posts_author_show');
$kale_posts_tags_show = kale_get_option('kale_posts_tags_show');
$kale_posts_sidebar = kale_get_option('kale_posts_sidebar');
$kale_posts_featured_image_show = kale_get_option('kale_posts_featured_image_show');
$kale_sidebar_size = kale_get_option('kale_sidebar_size');
$kale_posts_posts_nav_show = kale_get_option('kale_posts_posts_nav_show');
?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- Two Columns -->
<div class="row two-columns">
<!-- Main Column -->
<?php if($kale_posts_sidebar == 1) { ?>
<div class="main-column <?php if($kale_sidebar_size == 0) { ?> col-md-8 <?php } else { ?> col-md-9 <?php } ?>" role="main">
<?php } else { ?>
<div class="main-column col-md-12" role="main">
<?php } ?>
<!-- Post Content -->
<div id="post-<?php the_ID(); ?>" <?php post_class('entry entry-post'); ?>>
<div class="entry-header">
<?php if($kale_posts_meta_show == 1 && $kale_posts_date_show == 1) { ?>
<div class="entry-meta">
<div class="entry-date date updated"><?php the_date(); ?></div>
</div>
<?php } ?>
<div class="clearfix"></div>
</div>
<?php $title = get_the_title(); ?>
<?php if($title == '') { ?>
<h1 class="entry-title"><?php esc_html_e('Post ID: ', 'kale'); the_ID(); ?></h1>
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
<?php
if($kale_posts_featured_image_show == 1) {
if(has_post_thumbnail()) { ?>
<div class="entry-thumb"><?php the_post_thumbnail( 'full', array( 'alt' => get_the_title(), 'class'=>'img-responsive' ) ); ?></div><?php }
} ?>
<div class="single-content"><?php the_content(); wp_link_pages(); ?></div>
<?php if( ( $kale_posts_meta_show == 1 && ($kale_posts_category_show == 1 || $kale_posts_tags_show == 1 || $kale_posts_author_show == 1) ) ) { ?>
<div class="entry-footer">
<div class="entry-meta">
<?php if($kale_posts_author_show == 1) { ?><div class="entry-author"><span><?php esc_html_e('Author: ', 'kale'); ?></span><span class="vcard author author_name"><span class="fn"><?php the_author_posts_link(); ?></span></span></div><?php } ?>
<?php if($kale_posts_category_show == 1 && has_category()) { ?><div class="entry-category"><span><?php esc_html_e('Filed Under: ', 'kale'); ?></span><?php the_category(', '); ?></div><?php } ?>
<?php if($kale_posts_tags_show == 1 && has_tag()) { ?><div class="entry-tags"><span><?php esc_html_e('Tags: ', 'kale'); ?></span><?php the_tags('',', '); ?></div><?php } ?>
</div>
</div>
<?php } ?>
</div>
<!-- /Post Content -->
<?php if($kale_posts_posts_nav_show == 1) { ?>
<hr />
<div class="pagination-post">
<div class="previous_post"><?php previous_post_link('%link','%title',true); ?></div>
<div class="next_post"><?php next_post_link('%link','%title',true); ?></div>
</div>
<?php } ?>
<!-- Post Comments -->
<?php if ( comments_open() ) : ?>
<hr />
<?php comments_template(); ?>
<?php endif; ?>
<!-- /Post Comments -->
</div>
<!-- /Main Column -->
<?php if($kale_posts_sidebar == 1) get_sidebar(); ?>
</div>
<!-- /Two Columns -->
<?php endwhile; ?>
<hr />
<?php get_footer(); ?>
<?php
/**
* The template for displaying wppizza single posts
*
* @package kale
*/
?>
<?php get_header(); ?>
<?php
$kale_posts_meta_show = kale_get_option('kale_posts_meta_show');
$kale_posts_date_show = kale_get_option('kale_posts_date_show');
$kale_posts_category_show = kale_get_option('kale_posts_category_show');
$kale_posts_author_show = kale_get_option('kale_posts_author_show');
$kale_posts_tags_show = kale_get_option('kale_posts_tags_show');
$kale_posts_sidebar = kale_get_option('kale_posts_sidebar');
$kale_posts_featured_image_show = kale_get_option('kale_posts_featured_image_show');
$kale_sidebar_size = kale_get_option('kale_sidebar_size');
$kale_posts_posts_nav_show = kale_get_option('kale_posts_posts_nav_show');
?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- Two Columns -->
<div class="row two-columns">
<!-- Main Column -->
<?php if($kale_posts_sidebar == 1) { ?>
<div class="main-column <?php if($kale_sidebar_size == 0) { ?> col-md-8 <?php } else { ?> col-md-9 <?php } ?>" role="main">
<?php } else { ?>
<div class="main-column col-md-12" role="main">
<?php } ?>
<?php
/*
display wppizza single item post
replacing the "normal" post display
as rendered by the theme
*/
echo $do_single;
?>
<?php if($kale_posts_posts_nav_show == 1) { ?>
<hr />
<div class="pagination-post">
<div class="previous_post"><?php previous_post_link('%link','%title',true); ?></div>
<div class="next_post"><?php next_post_link('%link','%title',true); ?></div>
</div>
<?php } ?>
<!-- Post Comments -->
<?php if ( comments_open() ) : ?>
<hr />
<?php comments_template(); ?>
<?php endif; ?>
<!-- /Post Comments -->
</div>
<!-- /Main Column -->
<?php if($kale_posts_sidebar == 1) get_sidebar(); ?>
</div>
<!-- /Two Columns -->
<?php endwhile; ?>
<hr />
<?php get_footer(); ?>
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
Note: This is an overview . The actual structure is dependent on the shortcode attributes used as well as WPPizza -> Layout settings
/* category header/description (if not omitted) */ <header> [plugin-path]/wppizza/templates/markup/loop/header.php </header> /* if no results */ <div> [plugin-path]/wppizza/templates/markup/loop/no_results.php </div> /* menu items loop if results - for each menu item*/ <article> /* actual element order and or visibility depends on shortcode attributes, style in use and WPPizza -> Layout settings */ /* menu item title with additive idents (if any) */ <h2 -> span -> sub > [plugin-path]/wppizza/templates/markup/loop/posts.title.php </div> /* menu item thumbnails|placeholders (if any|used)*/ <div -> img|div > [plugin-path]/wppizza/templates/markup/loop/posts.thumbnail.php </div> /* menu item prices */ <div -> ul -> li ...> [plugin-path]/wppizza/templates/markup/loop/posts.prices.php </div> /* menu item text/content*/ <p> [plugin-path]/wppizza/templates/markup/loop/posts.content.php </div> /* permalink to single menu item (if used) */ <span -> a > [plugin-path]/wppizza/templates/markup/loop/posts.permalink.php </span> /* category (name) (if used) */ <div -> a > [plugin-path]/wppizza/templates/markup/loop/posts.category.php </div> </article> /* additives - if required to be displayed or specifically set by shortcode */ <div> [plugin-path]/wppizza/templates/markup/loop/additives.php </div> /* pagination - if necessary */ <div> [plugin-path]/wppizza/templates/markup/loop/pagination.php </div>
many display options are available by simply using the relevant shortcode attributes or layout settings available in WPPizza -> Layout instead of using filters
please refer to the filters in the documentation of each file that is being used for the menu items loop by clicking on the links below. basepath: [plugin-path]/wppizza/templates/markup
ensure you have also read the “Modify/Edit Templates – Readme”
basepath: [plugin-path]/wppizza/templates/markup
Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters
#wppizza-header-[category-slug]-[category-id]
.wppizza-header
.wppizza-header-[category-slug]
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
<header> <h1> category name </h1> <div> category description </div> </header>
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
wppizza_filter_menu_header_element @param: $element str (defaults to h1)
@return: str
examples:
add_filter('wppizza_filter_menu_header_element', 'prefix_filter_menu_header_element');
function prefix_filter_menu_header_element($element){
/* simply changing h1 to a h2 element */
return 'h2';
}
wppizza_filter_menu_header_class @param: $header_class array (array of classes used in various section of the header)
@return: array
examples:
add_filter('wppizza_filter_menu_header_class', 'prefix_filter_menu_header_class');
function prefix_filter_menu_header_class($classes){
/* adding a class to header - h1 element. use print_r($classes) to view array */
$classes['h1'][] ='my-class';
return $classes;
}
wppizza_filter_menu_header_markup @param: $markup array (array of markup elements)
@param: $category array (array of category slug/id)
@param: $style string (style used – default|responsive|grid)
@return: array
examples:
add_filter('wppizza_filter_menu_header_markup', 'prefix_filter_menu_header_markup', 10 ,3);
function prefix_filter_menu_header_markup($markup, $category, $style){
/*
notes:
use print_r($markup) to view markup array keys with their respective markup
use print_r($category) to view $category parameters available
use print_r($style) to view style used ( default|responsive|grid )
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* example: adding a paragraph AFTER all elements */
$markup['my_new_markup'] = '<p>more text after</p>';
/* example: adding a paragraph BEFORE all elements */
$new_markup = array();
$new_markup['my_new_markup'] = '<p>more text before</p>';
$new_markup += $markup; # add original markup after
return $new_markup ; # return new markup
/* example: adding a another paragraph BEFORE h1 element using helper function*/
$splice_before['my_new_markup'] = '<p>more text before</p>';
$markup = wppizza_array_splice($markup, $splice_before, 'h1', true );
/* example: adding a another paragraph AFTER h1 element using helper function*/
$splice_after['my_new_markup'] = '<p>more text after</p>';
$markup = wppizza_array_splice($markup, $splice_after, 'h1');
/* example: using actions of another plugin that by default outputs html to add it after all elements */
ob_start(); # start buffering
do_action('other_plugin_output'); # run action of other plugin that outputs things
$buffer= ob_get_contents(); # capture buffer in variable
ob_end_clean(); # clean buffer
$markup['my_new_markup'] = $buffer; # add buffered output
return $markup;
}
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/loop/header.php
Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters
.wppizza-no_results_found
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
<div>no results found text</div>
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
wppizza_filter_noresults_class @param: $classes array (array of classes used in wrapper div)
@return: array
examples:
add_filter('wppizza_filter_noresults_class', 'prefix_filter_noresults_class');
function prefix_filter_noresults_class($classes){
/* adding your own class name */
$classes[] ='my-class';
return $classes;
}
wppizza_filter_menu_noresults_markup @param: $markup array (array of markup elements)
@param: $style string (style used – default|responsive|grid)
@return: array
examples:
add_filter('wppizza_filter_menu_noresults_markup', 'prefix_filter_menu_noresults_markup', 10 ,2);
function prefix_filter_menu_header_markup($markup, $style){
/*
notes:
use print_r($markup) to view markup array keys with their respective markup
use print_r($style) to view style used ( default|responsive|grid )
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* example: adding a paragraph AFTER all elements */
$markup['my_new_markup'] = '<p>more text after</p>';
/* example: adding a paragraph BEFORE all elements */
$new_markup = array();
$new_markup['my_new_markup'] = '<p>more text before</p>';
$new_markup += $markup; # add original markup after
return $new_markup ; # return new markup
/* example: adding a another paragraph BEFORE div element using helper function*/
$splice_before['my_new_markup'] = '<p>more text before</p>';
$markup = wppizza_array_splice($markup, $splice_before, 'no_results_', true );
/* example: adding a another paragraph AFTER div element using helper function*/
$splice_after['my_new_markup'] = '<p>more text after</p>';
$markup = wppizza_array_splice($markup, $splice_after, '_no_results');
/* example: using actions of another plugin that by default outputs html to add it after all elements */
ob_start(); # start buffering
do_action('other_plugin_output'); # run action of other plugin that outputs things
$buffer= ob_get_contents(); # capture buffer in variable
ob_end_clean(); # clean buffer
$markup['my_new_markup'] = $buffer; # add buffered output
return $markup;
}
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/loop/no_results.php
Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters
#wppizza-article-[post_id]-[size_id]-0
.wppizza-article-h2
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
<h2> <span> post title </span> /* additive idents */ <sup> /* each additive idents */ <span>(ident)</span> </sup> </h2>
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
wppizza_filter_post_title_element @param: $element str (default h2)
@return: str
examples: changing the element will also change the class name ! i.e wppizza-article-h2 will become wppizza-article-h3 in the example below
add_filter('wppizza_filter_post_title_element', 'prefix_filter_post_title_element');
function prefix_filter_post_title_element($element){
/* change h2 to an h3 */
return 'h3';
}
wppizza_filter_post_title_class @param: $classes array (array of classes used in wrapper div)
@param: $post_data array (array of post_data)
@return: array
examples:
add_filter('wppizza_filter_post_title_class', 'prefix_filter_post_title_class', 10 ,2);
function prefix_filter_post_title_class($classes, $post_data){
/* adding your own class name */
$classes[] ='my-class';
return $classes;
}
wppizza_filter_post_title @param: $post_title str (menu item title)
@param: $post_id int (menu item id)
@return: array
examples:
add_filter('wppizza_filter_post_title', 'prefix_filter_post_title', 10 ,2);
function prefix_filter_post_title($post_title , $post_id ){
/* adding some text after the title */
$post_title .=' some text';
return $post_title ;
}
wppizza_filter_post_title_markup @param: $markup array (array of markup elements)
@param: $style string (style used – default|responsive|grid)
@return: array
examples:
add_filter('wppizza_filter_post_title_markup', 'prefix_filter_post_title_markup', 10 ,2);
function prefix_filter_menu_header_markup($markup, $style){
/*
notes:
use print_r($markup) to view markup array keys with their respective markup
use print_r($style) to view style used ( default|responsive|grid )
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* example: adding a paragraph AFTER all elements */
$markup['my_new_markup'] = '<p>more text after</p>';
/* example: adding a paragraph BEFORE all elements */
$new_markup = array();
$new_markup['my_new_markup'] = '<p>more text before</p>';
$new_markup += $markup; # add original markup after
return $new_markup ; # return new markup
/* example: adding a another paragraph BEFORE element using helper function*/
$splice_before['my_new_markup'] = '<p>more text before</p>';
$markup = wppizza_array_splice($markup, $splice_before, 'post_title_', true );
/* example: adding a another paragraph AFTER element using helper function*/
$splice_after['my_new_markup'] = '<p>more text after</p>';
$markup = wppizza_array_splice($markup, $splice_after, '_post_title');
/* example: using actions of another plugin that by default outputs html to add it after all elements */
ob_start(); # start buffering
do_action('other_plugin_output'); # run action of other plugin that outputs things
$buffer= ob_get_contents(); # capture buffer in variable
ob_end_clean(); # clean buffer
$markup['my_new_markup'] = $buffer; # add buffered output
return $markup;
}
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/loop/posts.title.php
Note: many display options are also available by simply using the relevant shortcode attributes or setting options in WPPizza -> Layout instead of using filters
#wppizza-article-img-[post_id]
.wppizza-article-image
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
/* featured images */ <div> <img src='path/to/image' /> </div> /* placeholder image (uses css to display placeholder) */ <div> <div>[empty]</div> </div>
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
wppizza_filter_post_thumbnail_class @param: $classes array (array of classes used in wrapper div)
@param: $post_data array (array of post_data)
@return: array
examples:
add_filter('wppizza_filter_post_thumbnail_class', 'prefix_filter_post_thumbnail_class', 10 ,2);
function prefix_filter_post_thumbnail_class($classes, $post_data){
/* adding your own class name */
$classes[] ='my-class';
return $classes;
}
wppizza_filter_post_title_markup @param: $markup array (array of markup elements)
@param: $style string (style used – default|responsive|grid)
@param: $has_thumbnail bool (true|false)
@param: $has_placeholder bool (true|false)
@return: array
examples:
add_filter('wppizza_filter_post_thumbnail_markup', 'prefix_filter_post_thumbnail_markup', 10 ,4);
function prefix_filter_post_thumbnail_markup($markup, $style, $has_thumbnail, $has_placeholder){
/*
notes:
use print_r($markup) to view markup array keys with their respective markup
use print_r($style) to view style used ( default|responsive|grid )
use print_r($has_thumbnail) to find out if post should display thumbnail
use print_r($has_placeholder) to find out if post should display placeholder
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* example: adding a paragraph AFTER all elements */
$markup['my_new_markup'] = '<p>more text after</p>';
/* example: adding a paragraph BEFORE all elements */
$new_markup = array();
$new_markup['my_new_markup'] = '<p>more text before</p>';
$new_markup += $markup; # add original markup after
return $new_markup ; # return new markup
/* example: adding a another paragraph BEFORE element using helper function*/
$splice_before['my_new_markup'] = '<p>more text before</p>';
$markup = wppizza_array_splice($markup, $splice_before, 'post_thumbnail_', true );
/* example: adding a another paragraph AFTER element using helper function*/
$splice_after['my_new_markup'] = '<p>more text after</p>';
$markup = wppizza_array_splice($markup, $splice_after, '_post_thumbnail');
/* example: using actions of another plugin that by default outputs html to add it after all elements */
ob_start(); # start buffering
do_action('other_plugin_output'); # run action of other plugin that outputs things
$buffer= ob_get_contents(); # capture buffer in variable
ob_end_clean(); # clean buffer
$markup['my_new_markup'] = $buffer; # add buffered output
return $markup;
}
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/loop/posts.thumbnail.php
Note: many display options are also available by simply using the relevant shortcode attributes or setting options in WPPizza -> Layout instead of using filters
#wppizza-article-sizes-[post_id]
.wppizza-article-sizes
.wppizza-article-prices-[size_id]
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
/* wrapper container */ <div> /* ul container, main currency symbols, prices container */ <ul> /* if main currency symbol left */ <li>$</li> <li> /* prices/sizes container ul*/ <ul> /* each price/size */ <li> <span>4.95</span> /* price */ <div>small</div> /* size, cart displayed using css */ </li> </ul> </li> /* if main currency symbol right */ <li>$</li> </ul> </div>
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
wppizza_filter_post_thumbnail_class @param: $classes array (array of classes used in wrapper div)
@param: $post_data array (array of post_data)
@return: array
examples:
add_filter('wppizza_filter_post_prices_class', 'prefix_filter_post_prices_class', 10 ,2);
function prefix_filter_post_prices_class($classes, $post_data){
/* adding your own class name */
$classes[] ='my-class';
return $classes;
}
wppizza_filter_post_prices @param: $prices array (array of parameters )
@param: $post_data array (array of post_data)
@param: $style string (style being used default|grid|responsive)
@return: array
examples:
add_filter('wppizza_filter_post_prices', 'prefix_filter_post_prices', 10 , 3);
function prefix_filter_post_prices($prices, $post_data, $style){
/*
notes:
use print_r($prices) to view all array keys with their respective values
use print_r($post_data) to view all array keys with their respective values
use print_r($style) to view style used ( default|responsive|grid )
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* adding "from" before each price */
foreach($prices as $k=>$p){
$prices[$k]['price'] = 'from '.$prices[$k]['price'];
}
return $prices;
}
wppizza_filter_post_prices_markup @param: $markup array (array of markup elements)
@param: $style string (style used – default|responsive|grid)
@param: array (array of post parameters)
@param: array (array of prices parameters)
@return: array
examples:
add_filter('wppizza_filter_post_prices_markup', 'prefix_filter_post_prices_markup', 10 , 4);
function prefix_filter_post_prices_markup($markup, $style, $post, $prices){
/*
notes:
use print_r($markup) to view markup array keys with their respective markup
use print_r($style) to view style used ( default|responsive|grid )
use print_r($post) to view post parameters
use print_r($prices) to view prices parameters
use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin
*/
/* example: adding a paragraph AFTER all elements */
$markup['my_new_markup'] = '<p>more text after</p>';
/* example: adding a paragraph BEFORE all elements */
$new_markup = array();
$new_markup['my_new_markup'] = '<p>more text before</p>';
$new_markup += $markup; # add original markup after
return $new_markup ; # return new markup
/* example: adding a another paragraph BEFORE element using helper function*/
$splice_before['my_new_markup'] = '<p>more text before</p>';
$markup = wppizza_array_splice($markup, $splice_before, 'post_sizes_', true );
/* example: adding a another paragraph AFTER element using helper function*/
$splice_after['my_new_markup'] = '<p>more text after</p>';
$markup = wppizza_array_splice($markup, $splice_after, '_post_sizes');
/* example: using actions of another plugin that by default outputs html to add it after all elements */
ob_start(); # start buffering
do_action('other_plugin_output'); # run action of other plugin that outputs things
$buffer= ob_get_contents(); # capture buffer in variable
ob_end_clean(); # clean buffer
$markup['my_new_markup'] = $buffer; # add buffered output
return $markup;
}
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/loop/posts.prices.php