Forum Replies Created

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter thomas

    (@beloutte)

    ok great ??
    I knew it hasn’t been tested with 4.3 but I thought my post could be of some use to you ??

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    ok thanks for your patience !

    so here are my defaults:

    $defaults = array(
        'slks_fade' => 'false',
        'slks_autoplay' => true,
        'slks_autoheight' => true,
        ...
    );

    one of my checkbox:

    printf(
        '<input id="%1$s" name="slks_option_name[%1$s]" type="checkbox" %2$s /> <label for="%1$s">'.__("Enable Auto Play","slick-slider").'</label>',
       'slks_autoplay',
       checked ( $this->options['slks_autoplay'], true, false )
    );

    Everything is working fine on activation; chekboxes are checked with the right default values…
    But if I uncheck just one box and save the settings,I have this debug message:

    Notice: Undefined index: slks_show_arrows

    and most important, all checkboxes become unchecked :/

    what’s wrong ?

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    I can’t make it work ??

    In my $defaults var_dump I have : [“slks_autoplay”] => bool(false)
    (I’ve set ‘slks_autoplay’ => false )

    and I get this in $this->option var_dump : [“slks_autoplay”] => string(2) “on”

    my field is modified like this :

    '<input id="%1$s" name="slks_option_name[%1$s]" type="checkbox" value="false" %2$s /> <label for="%1$s">'.__("Enable Auto Play","slick-slider").'</label>',
     'slks_autoplay',
     checked (isset( $this->options['slks_autoplay'] ), true, false )

    that’s hard ^^

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    ok thanks !

    I was sure there was something wrong with the checkboxes ??

    what I want is to have values returned : “true” if checked and “false” if uncheked.

    so if I modifiy the code like this, is it correct ?

    '<input id="%1$s" name="slks_option_name[%1$s]" type="checkbox" value="true" %2$s /> <label for="%1$s">'.__("Display Dots","slick-slider").'</label>',
                'slks_show_dots',
                checked (isset( $this->options['slks_show_dots'] ), "true", "false" )

    or should I use your example ? I’ll try it anyway ??

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    ok,
    I managed to get it work by changing the code like this:

    $defaults = array(
            	'slks_fade' => 'false',
            	'slks_speed' => 3000,
            	'slks_autoplay' => 'on',
            	'slks_autoheight' => 'on',
            	'slks_show_arrows' => 'on',
            	'slks_show_dots' => 'on',
            	'slks_arrows' => '#444999',
            	'slks_dots' => '#555aaa'
            ); 
    
    $this->options = get_option( 'slks_option_name', $defaults );

    what do you think ?

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    Hello Samuel,

    Ok I tried your function and it’s working ?? except for the checkboxes…
    and also, when I activate the plugin the first time, I have the defaults values, but on the option page input fields are empty, checkboxes uncheked.

    when I change the settings, the checkboxes remain checked even if I uncheked then (but the values are changing…) There is no problem if I delete the default checkboxes values…

    $defaults = array(
            	'slks_fade' => 'false',
            	'slks_speed' => 3000,
    /*
            	'slks_autoplay' => 'on',
            	'slks_autoheight' => 'on',
            	'slks_show_arrows' => 'on',
            	'slks_show_dots' => 'on',
    */
            	'slks_arrows' => '#ffaa00',
            	'slks_dots' => '#003300'
            );

    so, how can I have these checkbox work ? and how can my input fields appear filled when I first visit the option page ?

    here is the whole code : https://pastebin.com/VcvzSe4q

    thanks !!

    Forum: Fixing WordPress
    In reply to: Plugin option page
    Thread Starter thomas

    (@beloutte)

    Hello Samuel

    Thanks for your answer ! I’ll try this this afternoon and keep you posted.

    Any idea how the checkbox can return “true/false” instead of “0/null” ?

    Thread Starter thomas

    (@beloutte)

    Hello Ben,

    Is there now a way to make the upload fields required ??
    to check if there’s at least one image, for example.

    I really need to, as the image is the only field in the form… :/

    thanks !

    Thread Starter thomas

    (@beloutte)

    Hi Ben,

    thanks, I’ll take a look !

    Thread Starter thomas

    (@beloutte)

    I’ve just tried with :
    'has_archive' => true
    added in my functions.php post-type init.
    and a template : archive-epicerie.php

    And it’s working this way.
    But I still don’t understand why it’s not working with page templates…

    If someone’s got an idea !
    thanks

    Thread Starter thomas

    (@beloutte)

    thanks a lot for your answer !
    it’s strange, I thought I tried this syntax… :/
    anyway thank you very much ??

    Thread Starter thomas

    (@beloutte)

    hey,
    finally did something else, far more simple…

    <?php
    	wp_reset_postdata();
    	query_posts($query_string . '&orderby=title&order=ASC');
    ?>
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    
    ... the rest

    it’s working for achive template and taxonomy template

    Thread Starter thomas

    (@beloutte)

    thanks for your answer,
    the context is that I want to output the posts of my custom taxonomies ordered by title, not by publication date… or what do you mean by context ?
    my query seems to work because the posts of my customs taxonomies “marque” are displayed by title, but twice…

    here is the full template : https://pastebin.com/usZxS1RP

    and a screenshot

    Thread Starter thomas

    (@beloutte)

    thank you so much andrew, it works !

    I just had to add the good relative path :

    echo '<a href="../marque/ ' . $category->slug . ' " ' . '>';

    so, final code if it can be useful for someone else :

    <?php
    $args=array(
      'taxonomy' => 'marque',
      'orderby' => 'name',
      'order' => 'ASC'
      );
    
    $marques = get_categories($args);
      foreach($marques as $category) {
    
     	$tax_term_id = $category->term_taxonomy_id;
     	$images = get_option('taxonomy_image_plugin');
    
    	echo '<div class="vignette-cata"><figure>';
    	echo '<a href="../marque/' . $category->slug . ' "  ' . '>';
    	echo wp_get_attachment_image( $images[$tax_term_id], 'medium' );
    	echo '</a>';
    	echo '<figcaption><a href="../marque/' . $category->slug . ' "  ' . '>' . $category->name.'</a></figcaption> ';
    	echo '</figure></div>';  }
    
    ?>
    Thread Starter thomas

    (@beloutte)

    hopefully I managed to display images with taxonomy image plugin ??

    still have to make the links to work…

    my code :

    <?php
    $args=array(
      'taxonomy' => 'marque',
      'orderby' => 'name',
      'order' => 'ASC'
      );
    
    $marques = get_categories($args);
      foreach($marques as $category) {
    
     	$tax_term_id = $category->term_taxonomy_id;
     	$images = get_option('taxonomy_image_plugin');
    
    	echo '<div class="vignette-cata"><figure>';
    	echo '<a href=" ' . get_category_link( $category->term_id ) . ' "  ' . '>';
    	echo wp_get_attachment_image( $images[$tax_term_id], 'medium' );
    	echo '</a>';
    	echo '<figcaption><a href=" ' . get_category_link( $category->term_id ) . ' "  ' . '>' . $category->name.'</a></figcaption> ';
    	echo '</figure></div>';  }
    
    ?>
Viewing 15 replies - 1 through 15 (of 23 total)