WordPress.org

Ready to get started?Download WordPress

Forums

Qtranslate Slug
[resolved] Help! Notice: Undefined offset: 0 (8 posts)

  1. Daniel
    Member
    Posted 1 year ago #

    Hello,

    I'm getting errors while implementing this plugin-in into my theme.

    Here's the error:

    Notice: Undefined offset: 0 in .../wp-includes/query.php on line 2249

    And here's how I'm calling this information:

    <?php
    	$menuloop = new WP_Query(array(
    		'posts_per_page' => -1,
    		'meta_key' => 'menuoption_menu_pricing',
    		'orderby' => 'meta_value_num',
    		'order' => 'ASC',
    		'post_type' => 'menu',
    		'tax_query' => array(
    			array(
    			'taxonomy' => 'menu_type',
    			'field' => 'slug',
    			'terms' => wp_get_post_terms($post->ID, 'menu_type', array("fields" => "slugs"))
    			)
    			)
    	));
    ?>

    The theme also has portfolio sliders on the main page which disappear when this plugging is activated…

    Here's how the code to load the slides:

    <?php
    	$portfolio_type = get_the_term_list( $post->ID, 'portfolio_type' );
    	$portfolioloop = new WP_Query(array(
    		'paged'          => get_query_var('paged'),
    		'post_type'      => 'portfolio',
    		'posts_per_page' => -1,
    		'tax_query'      => array(
    	// Note: tax_query expects an array of arrays!
    		array(
    		'taxonomy' => 'portfolio_type', // my guess
    		'field'    => 'name',
    		'terms'    => $portfolio_type
    		),
    		),
    	));
    ?>

    I'm not great when it comes to php coding, but I'm sure the problem is due to the way the codes are written above.

    I'm sure it's an easy fix for someone with experience! :)

    Thank in advance for your help!

    http://wordpress.org/extend/plugins/qtranslate-slug/

  2. Carlos
    Member
    Plugin Author

    Posted 1 year ago #

    Try with version 1.1.5

  3. Daniel
    Member
    Posted 1 year ago #

    Thanks Carlos! You ROCK!!!! :)

    It works, however this update seams to be buggy (Unless of course it's something i did!)

    Everything seems to work fine until I toggle from french to english...

    For Example, when I'm on:
    http://www.mywebsite.com/fr/menu-fr/entrees/

    Then click "EN" to view it in English, it wants to direct me to:
    http://www.mywebsite.com/menu-fr/entrees/ (without the /fr/ directing me to a 404 Page Not Found)

    When it should direct me to:
    http://www.mywebsite.com/menu-en/starters/

    In addition to this, when you toggle languages (though the qTrqnslate Menu) on non-category pages, it seems to want to use the native slug rather than the one created by the plugin.

    Any idea as to why this is happening? Should I start a new topic for this?

    Thanks again Carlos! :)

  4. Carlos
    Member
    Plugin Author

    Posted 1 year ago #

    Hummm it seems to remain some kind of conflict with /pages/sub-pages/ let me check this... for now try to avoid hierarchical pages...

  5. Carlos
    Member
    Plugin Author

    Posted 1 year ago #

    In my dev installation works fine: WordPress 3.5.1 + Qtranslate 2.5.34 + TwentyTwelve
    How did you include the language switcher ?

  6. Daniel
    Member
    Posted 1 year ago #

    Hi Carlos, I really appreciate your support! :)

    Here's what I used for the switcher:
    <?php if ( function_exists( 'qtrans_generateLanguageSelectCode' ) ) qtrans_generateLanguageSelectCode( 'text' ); ?>

  7. Carlos
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, that's the problem, you are using the function provided by qtranslate.
    You must use the qtranslate_slug function:

    <?php if (function_exists('qts_language_menu') ) qts_language_menu('text'); ?>

    Greetings!
    C.

  8. Daniel
    Member
    Posted 1 year ago #

    I feel like such an idiot!!!! My fault for not reading the documentation properly!

    Thank you so much for your time and prompt support!

    You the man!!!!!!! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic