Modify Templates – WPPizza Documentation https://docs.wp-pizza.com documentation for the wordpress wppizza plugin (version 3.x) Sat, 09 May 2020 17:27:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.3 wppizza / markup / search https://docs.wp-pizza.com/wppizza-markup-search/ Tue, 21 Nov 2017 15:43:50 +0000 https://docs.wp-pizza.com/?p=266 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 ]]> Displaying WPPizza menu items in search results

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

]]>
wppizza / markup / search / search.php https://docs.wp-pizza.com/wppizza-markup-search-search-php/ Tue, 21 Nov 2017 16:39:36 +0000 https://docs.wp-pizza.com/?p=267 …]]> Display wppizza menu items in search results keeping prices and other relevant WPPizza menu item information intact to work with your theme

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:

  • create the following directory structure in your child theme: wppizza/markup/search so your whole structure will look something like this /[path]/[to]/[my]/[child-theme]/wppizza/markup/search
  • locate the search.php file in your theme directory and copy it to the above created directory so the file structure will now look like this /[path]/[to]/[my]/[child-theme]/wppizza/markup/search/search.php
    NOTE: Some themes do not provide a search.php file. I would suggest you ask the theme developer to create/add one or ask him/her which template part is responsible for displaying search results.
    Unfortunately, I will not be able to help you with your particular theme if this is the case.
  • open this “search.php” file in a suitable text editor
  • typically you will find something like
    while ( have_posts() ) : the_post();
    	get_template_part( 'template-parts/content', 'search' );
    endwhile;
  • REPLACE
    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

  • the whole file will now be similar to this
    <?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(); ?>
    
  • make sure the parameters match. i.e if your original template part is
    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' );
    }
    
  • make sure you keep everything before and after the changed codeblock intact
  • save the file
  • you should now have the same layout for a single wppizza item in your search results as you have when displaying categories (see below)

Quick summary:

  • COPY /[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
  • REPLACE anything in created/copied search.php like
    # - 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 - #
  • keep everything else

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

]]>
wppizza / markup / single https://docs.wp-pizza.com/wppizza-markup-single/ Tue, 13 Jun 2017 15:57:16 +0000 http://v3x.wp-pizza.com/?p=151 Appearance -> Widgets -> WPPizza Type:Search or search widget ]]> Displaying single WPPizza menu items called from permalink or search results

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

]]>
wppizza / markup / single / single.php https://docs.wp-pizza.com/wppizza-markup-single-single-php/ Tue, 13 Jun 2017 15:54:15 +0000 http://v3x.wp-pizza.com/?p=150 …]]> Display single wppizza menu item keeping prices and other relevant WPPizza menu item information intact to work with your theme

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:

  • create the following directory structure in your child theme: wppizza/markup/single so your whole structure will look something like this /[path]/[to]/[my]/[child-theme]/wppizza/markup/single
  • copy your theme’s “single.php” file into the above created directory, so the structure will now look something like this: /[path]/[to]/[my]/[child-theme]/wppizza/markup/single/single.php
  • open this “single.php” file in a suitable text editor
  • typically you will find something like
    
    	while ( have_posts() ) : the_post();
    	if(is_single()){
    		.....
    	}
    	endwhile;
    	
  • REPLACE that whole loop – including the “while ( have_posts() …. etc …. endwhile; ” – with simply echo $do_single;, leaving any codeblocks before and after intact and save
  • the whole file will now be similar to this
    <?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(); ?>
    
    
  • if you wish to enable comments, add/leave the comments template according to how your theme displays them right after the echo $do_single;.
    Typically this will be something like this, but might be somewhat different for your theme

    
    	// If comments are open or we have at least one comment, load up the comment template.
    	if ( comments_open() || get_comments_number() ) {
    		comments_template();
    	}
    
  • if your theme’s single.php also provides links/navigation you wish to use do the same as with the comments codeblock referred to above. adding it in your preferred place.
    Typically navigation links will look similar to this, but might be somewhat different for your theme

    
    	// 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:

  • Before
    <?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(); ?>
  • After
    <?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(); ?>
    
]]>
wppizza / markup / loop https://docs.wp-pizza.com/wppizza-markup-loop/ Tue, 13 Jun 2017 14:15:28 +0000 http://v3x.wp-pizza.com/?p=107 …]]> Category loop – displaying menu items in category/ies depending on shortcode

CSS Targeting

  • Use your browsers element inspector to identify all classes and id’s for each element

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

Structure

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>


Filters available

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

Actions available

  • none

Editing files directly

ensure you have also read the “Modify/Edit Templates – Readme”

basepath: [plugin-path]/wppizza/templates/markup

Modules used in file

Module used by other template file(s)

  • none
]]>
wppizza / markup / loop / header.php https://docs.wp-pizza.com/wppizza-markup-loop-header-php/ Tue, 13 Jun 2017 15:47:15 +0000 http://v3x.wp-pizza.com/?p=140 …]]> Category header

Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters

CSS Targeting

  • header element id: #wppizza-header-[category-slug]-[category-id]
  • header element class: .wppizza-header
  • header element class: .wppizza-header-[category-slug]
  • Use your browsers element inspector to identify all classes and id’s

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

Structure

 <header>

	 <h1> category name </h1>
	 <div> category description </div>

 </header>

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).

  • filter name: wppizza_filter_menu_header_element
    purpose: modify h1 element to use another 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';
    }
    		
  • filter name: wppizza_filter_menu_header_class
    purpose: modify classes used in header

    @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;
    }
    		
  • filter name: wppizza_filter_menu_header_markup
    purpose: modify output of header element

    @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;
    }
    		

Actions available

  • none

Editing files directly

ensure you have also read the Modify/Edit Templates

basepath: [plugin-path]/wppizza/templates/markup

filepath: [plugin-path]/wppizza/templates/markup/loop/header.php

Modules used in file

  • none

Module used by other template file(s)

  • none
]]>
wppizza / markup / loop / no_results.php https://docs.wp-pizza.com/wppizza-markup-loop-no_results-php/ Tue, 13 Jun 2017 15:47:27 +0000 http://v3x.wp-pizza.com/?p=141 …]]> Menu items – No results

Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters

CSS Targeting

  • div element class: .wppizza-no_results_found
  • Use your browsers element inspector to identify all classes and id’s

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

Structure

 <div>no results found text</div>

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).

  • filter name: wppizza_filter_noresults_class
    purpose: modify classes used

    @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;
    }
    		
  • filter name: wppizza_filter_menu_noresults_markup
    purpose: modify output of element

    @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;
    }
    		

Actions available

  • none

Editing files directly

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

Modules used in file

  • none

Module used by other template file(s)

  • none
]]>
wppizza / markup / loop / posts.title.php https://docs.wp-pizza.com/wppizza-markup-loop-posts-title-php/ Tue, 13 Jun 2017 15:47:38 +0000 http://v3x.wp-pizza.com/?p=142 …]]> Menu items – Title with additive idents (if any)

Note: many display options are also available by simply using the relevant shortcode attributes instead of using filters

CSS Targeting

  • h2 element ID: #wppizza-article-[post_id]-[size_id]-0
  • h2 element class: .wppizza-article-h2
  • Use your browsers element inspector to identify all classes and id’s

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

Structure

 <h2>
	<span>
		post title
	</span>
	
	/* additive idents */
	<sup>
		/* each additive idents */
		<span>(ident)</span>

	</sup>

 </h2>

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).

  • filter name: wppizza_filter_post_title_element
    purpose: modify h2 element to be something else

    @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';
    }
    		
  • filter name: wppizza_filter_post_title_class
    purpose: modify classes used

    @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;
    }
    		
  • filter name: wppizza_filter_post_title
    purpose: modify 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 ;
    }
    		
  • filter name: wppizza_filter_post_title_markup
    purpose: modify output of element

    @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;
    }
    		

Actions available

  • none

Editing files directly

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

Modules used in file

  • none

Module used by other template file(s)

  • none
]]>
wppizza / markup / loop / posts.thumbnail.php https://docs.wp-pizza.com/wppizza-markup-loop-posts-thumbnail-php/ Tue, 13 Jun 2017 15:47:48 +0000 http://v3x.wp-pizza.com/?p=143 Layout instead of using filters CSS Targeting element ID: #wppizza-article-img-[post_id] element class: .wppizza-article-image ]]> Menu items – featured images / thumbnails / image placeholder (if any)

Note: many display options are also available by simply using the relevant shortcode attributes or setting options in WPPizza -> Layout instead of using filters

CSS Targeting

  • element ID: #wppizza-article-img-[post_id]
  • element class: .wppizza-article-image
  • Use your browsers element inspector to identify all classes and id’s

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

Structure

/* featured images */
 <div>
	<img src='path/to/image' />
 </div>

/* placeholder image (uses css to display placeholder) */
 <div>
	<div>[empty]</div> 
 </div>

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).

  • filter name: wppizza_filter_post_thumbnail_class
    purpose: modify classes used

    @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;
    }
    		
  • filter name: wppizza_filter_post_title_markup
    purpose: modify output of element

    @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;
    }
    		

Actions available

  • none

Editing files directly

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

Modules used in file

  • none

Module used by other template file(s)

  • none
]]>
wppizza / markup / loop / posts.prices.php https://docs.wp-pizza.com/wppizza-markup-loop-posts-prices-php/ Tue, 13 Jun 2017 15:47:58 +0000 http://v3x.wp-pizza.com/?p=144 Layout instead of using filters CSS Targeting element ID: #wppizza-article-sizes-[post_id] element class: .wppizza-article-sizes element class: ]]> Menu items – displaying sizes, prices, currency symbols, cart icon

Note: many display options are also available by simply using the relevant shortcode attributes or setting options in WPPizza -> Layout instead of using filters

CSS Targeting

  • element ID: #wppizza-article-sizes-[post_id]
  • element class: .wppizza-article-sizes
  • element class: .wppizza-article-prices-[size_id]
  • Use your browsers element inspector to identify all classes and id’s

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

Structure

/* 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>

Filters available

apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).

  • filter name: wppizza_filter_post_thumbnail_class
    purpose: modify classes used

    @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;
    }
    		
  • filter name: wppizza_filter_post_prices
    purpose: modify each price array before outputting it for markup

    @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;
    }
    		
  • filter name: wppizza_filter_post_prices_markup
    purpose: modify output of element

    @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;
    }
    		

Actions available

  • none

Editing files directly

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

Modules used in file

  • none

Module used by other template file(s)

  • none
]]>
Powered by atecplugins.com