WordPress.org

Ready to get started?Download WordPress

Forums

MarketPress - WordPress eCommerce
[resolved] [Plugin: MarketPress Lite - WordPress eCommerce] PHP Error Using Custom Theme (8 posts)

  1. microguy
    Member
    Posted 2 years ago #

    I've installed this plugin at my website http://www.luckyguitar.com and it works great with the default wordpress theme and all other themes I've tested except for the custom theme I normally use with my website. ):

    The issue is related to the drop down sub-pages of the store menu in page header. Here the details of the issue:

    Error message = Warning: Missing argument 2 for MarketPress::filter_list_pages() in /nfs/c04/h02/mnt/64321/domains/luckyguitar.com/html/wp-content/plugins/wordpress-ecommerce/marketpress.php on line 1152

    The Store drop down menu works but the text created by this error message is displayed on the blog page above the store menu. I have been able to temporarily "solve" this issue by commenting out the following line of code from the file = wordpress-ecommerce/marketpress.php

    //add_filter( 'wp_list_pages', array(&$this, 'filter_list_pages'), 10, 2 );

    I strongly suspect that this has something to do with my code in the header.php of my main theme. Below is the relevant sections of code as narrowed down as I can get. I think somewhere in this code lies the answer.

    <div id="header_image">
    
    <div id="menu">
    <div class="menu_container">
    
    <ul>
    
    <?php if (!freshy_yy_menu()) : ?>
    
    <?php if ('page' != get_option('show_on_front')) : // no page has been chosen as frontpage ?>
    
    <li class="<?php if (is_home()) echo 'current_page_item'; ?>">
    <a href="<?php echo get_settings('home'); ?>">
    <?php _e($freshy_options['first_menu_label'],TEMPLATE_DOMAIN); ?>
    </a>
    </li>
    
    <?php endif; ?>
    
    <!---- I think this is the problem marketpress -->
    <?php freshy_wp_list_pages('sort_column=menu_order&title_li='); ?>
    <!---- commented out code is around line 200 of main marketpress php ---->
    <!---- lost drop down menus ------>
    
    <?php endif; ?>
    
    <?php if ($freshy_options['custom_menus'])
    {
    foreach ($freshy_options['custom_menus'] as $custom_menu)
    {
    ?>
    <li>
    <a href="<?php echo $custom_menu['url']; ?>">
    <?php _e($custom_menu['label'],TEMPLATE_DOMAIN); ?>
    </a>
    </li>
    <?php
    }
    }
    ?>
    
    <?php if ($freshy_options['last_menu_type']=='email' || $freshy_options['last_menu_type']=='link') : ?>
    
    <li class="last_menu">
    
    <?php if ($freshy_options['last_menu_type']=='email') : ?>
    
    <a href="mailto:<?php echo $freshy_options['contact_email']; ?>">
    <?php _e($freshy_options['last_menu_label'],TEMPLATE_DOMAIN); ?>
    </a>
    
    <?php elseif ($freshy_options['last_menu_type']=='link') : ?>
    
    <a href="<?php echo $freshy_options['contact_link']; ?>">
    <?php _e($freshy_options['last_menu_label'],TEMPLATE_DOMAIN); ?>
    </a>
    
    <?php endif; ?>
    
    </li>
    
    <?php endif; ?>
    
    </ul>
    
    </div><span class="menu_end"></span>
    </div>
  2. microguy
    Member
    Posted 2 years ago #

    Here is the relevant code from the themes functions.php

    function freshy_wp_list_pages($args = '') {
    	$defaults = array(
    		'depth' => 0, 'show_date' => '',
    		'date_format' => get_option('date_format'),
    		'child_of' => 0, 'exclude' => '',
    		'title_li' => __('Pages'), 'echo' => 1,
    		'authors' => '', 'sort_column' => 'menu_order, post_title'
    	);
    
    	$r = wp_parse_args( $args, $defaults );
    	extract( $r, EXTR_SKIP );
    
    	$output = '';
    	$current_page = 0;
    
    	// sanitize, mostly to keep spaces out
    	$r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']);
    
    	// Allow plugins to filter an array of excluded pages
    	$r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
    
    	// Query pages.
    	$pages = get_pages($r);
    
    	if ( !empty($pages) ) {
    		if ( $r['title_li'] )
    			$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
    
    		global $wp_query;
    		if ( is_page() )
    			$current_page = $wp_query->get_queried_object_id();
    		$output .= freshy_walk_page_tree($pages, $r['depth'], $current_page, $r);
    
    		if ( $r['title_li'] )
    			$output .= '</ul></li>';
    	}
    
    	$output = apply_filters('wp_list_pages', $output);
    
    	if ( $r['echo'] )
    		echo $output;
    	else
    		return $output;
    }
  3. microguy
    Member
    Posted 2 years ago #

    Anyone?

  4. DavidM
    Member
    Posted 2 years ago #

    Hi microguy, I've just tried out the plugin alongside Freshy 2 and I didn't encounter that issue. I set the front-page to a static page and when viewing the blog page, didn't notice any errors.

    On that note, are you using the latest version of the theme? If not, could you let me know what version you're working with so I can test that?

    Also, not having gone through the theme's code, I wasn't sure, but have you made any customizations to the theme code?

  5. microguy
    Member
    Posted 2 years ago #

    David,

    I received your reply via EMail but don't see it in this thread for some reason?

    DavidM - WPMU DEV wrote:

    Hi microguy, I've just tried out the plugin alongside Freshy 2 and I didn't encounter that issue. I set the front-page to a static page and when viewing the blog page, didn't notice any errors.
    On that note, are you using the latest version of the theme? If not, could you let me know what version you're working with so I can test that?
    Also, not having gone through the theme's code, I wasn't sure, but have you made any customizations to the theme code?

  6. microguy
    Member
    Posted 2 years ago #

    David,

    Thank you for your reply....

    To answer your question, the Freshy 2 theme has not been updated to my knowledge for a long time.

    It's my understanding that the last official release won't run under the latest WordPress release or PHP 5. I have been patching mine and keeping it running by modifying it as needed since the developer abandoned the project.

    The code I posted above I believe contains some small error that is leading to this problem. I can provide the entire them as a zip file if that would help.

    Thanks again,
    Greg

  7. DavidM
    Member
    Posted 2 years ago #

    Hi microguy,

    How about this? Since that theme doesn't support custom menus, why don't we go ahead and add in custom menu support, meanwhile completely avoiding the issue the theme has with MarketPress menus?

    As you've apparently made edits already, this should be as simple as another couple minor edits. I just ran through this on a test site to be sure it worked too. :)

    With that, everything from below the first
    <ul>
    ...to just above the closing
    </ul>
    in header.php, replace with the following:

    <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>

    Then, in functions.php, add in this:

    if ( function_exists( 'register_nav_menu' ) ) {
    	register_nav_menu( 'main-menu', 'Main Menu' );
    }

    And that should do it! You'll not only have MarketPress support but you'll have custom menu support so you can fully customize your menu.

    Would that work for you?

  8. microguy
    Member
    Posted 2 years ago #

    That worked brilliantly! I will mark this topic as resolved now.

    Many, many thanks for your valuable time and energy.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic