Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • you can translate menus like this:

    <!–:ge–>TiTle-GEO<!–:–><!–:en–>TiTle-ENG<!–:–>
    or
    [:en]TiTle-ENG[:ge]TiTle-GEO

    and if you want to change custom links for each language you should try this:
    1. header.php

    // You place this instead of your previous wp_nav_menu() call in your theme. Just remember to change the "theme_location" parameter
    wp_nav_menu(array('theme_location' => 'your_theme_location', 'container' => '', 'fallback_cb' => '', 'walker' => new CustomLinkModifierWalker()));

    2. my theme / functions.php

    // You put this piece of code in your functions.php file
    class CustomLinkModifierWalker extends Walker_Nav_Menu {
       function __( $text ) {
          if ( preg_match_all('~(.*?)\|(\w{2,})\|~', $text, $matches) ) {
             $text = '';
             foreach ($matches[1] as $i => $match) {
                $text .= "[:{$matches[2][$i]}]$match";
             }
             $text = __( $text );
          }
          return $text;
       }
       function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
          global $wp_query;
          $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    
          $class_names = $value = '';
    
          $classes = empty( $item->classes ) ? array() : (array) $item->classes;
          $classes[] = 'menu-item-' . $item->ID;
    
          $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
          $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
    
          $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
          $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
    
          $output .= $indent . '<li' . $id . $value . $class_names .'>';
    
          $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
          $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
          $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
          $attributes .= ! empty( $item->url )    ? ' href="' . esc_attr( $this->__( $item->url )  ) .'"' : '';
    
          $item_output = $args->before;
          $item_output .= '<a'. $attributes .'>';
          $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
          $item_output .= '';
          $item_output .= $args->after;
    
          $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
       }
    }

    and after that try this code to change manu custom links for each language https://www.dhg.ge/about-us/?lang=en|en|https://www.dhg.ge/about-us/?lang=ge|ge|

    and if you want to translate Custom Taxonomies in WordPress Add this into your Template functions.php at the end of the file, and QTranslate will work properly.

    function qtranslate_edit_taxonomies(){
    $args=array(
    'public' => true ,
    '_builtin' => false
    );
    $output = 'object'; // or objects
    $operator = 'and'; // 'and' or 'or'
    
    $taxonomies = get_taxonomies($args,$output,$operator);
    
    if ($taxonomies) {
    foreach ($taxonomies as $taxonomy ) {
    add_action( $taxonomy->name.'_add_form', 'qtrans_modifyTermFormFor');
    add_action( $taxonomy->name.'_edit_form', 'qtrans_modifyTermFormFor');
    }
    }
    }
    add_action('admin_init', 'qtranslate_edit_taxonomies');

    GL

    miseva

    (@miseva)

    hi my template already has a rating system, but i want to change it with this widget, so i activated this plugin and it works, but i want to change something here:

    1. my site: https://hotels.myjournal.ge/?place=asdasdasdas as you see rating is in the middle of post, i want some code to replace it in place detail sidebar (right corner of site) where i already have a ratings.

    `<?php if(get_option(‘ptthemes_disable_rating’) == ‘no’) { ?>
    <p> <span class=”i_rating”><?php echo RATING.” :aa”; ?></span>
    <span class=”single_rating”>
    <?php echo get_post_rating_star($post->ID); ?>
    </span>
    </p><?php } ?>`

    here is the code and i want some code of this plugin to replace it with it.\

    2. i want to show ratings in index page: https://hotels.myjournal.ge/
    you see there is ratings at index page, and code to show this is:

    <?php if($my_post_type != 'post' && get_option('ptthemes_disable_rating') == 'no') { ?><span class="rating"><?php echo get_post_rating_star($post->ID);?></span> <?php } ?>

    i need some code of this plugin to replace it.

Viewing 2 replies - 1 through 2 (of 2 total)