Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Hans

    (@hmobron)

    ?? totally right. browser cache!

    Thread Starter Hans

    (@hmobron)

    Hello Bbcorks, the code here is working with out the remove_filter action. In the normal media library all icon’s are showing including the .ged. In my Media library also. Thank you very much.

    function mobgen_set_incon( $icon_dir ){
                      return   plugin_dir_path( __FILE__ ).'images/icons';
    }
    function mobgen_myme_icon($path, $mime='', $id =0){
     // echo '<script>console.log("'.$mime.'")</script>';
      if($mime == 'text/ged'){
    
        $path = PLUGIN_URL.'images/ged.png';
         add_filter( 'icon_dir','mobgen_set_incon',10,3);
         //remove_filter('icon_dir','mobgen_set_incon');
      }
    
      return $path;
    }
    add_filter( 'wp_mime_type_icon','mobgen_myme_icon', 10,3 );
    Thread Starter Hans

    (@hmobron)

    It isn’t working

    function mobgen_myme_icon($path, $mime='', $id =0){
     // echo '<script>console.log("'.$mime.'")</script>';
      if($mime == 'text/ged'){
    
        $path = PLUGIN_URL.'images/ged.png';
    
      }
     apply_filters( 'icon_dir',plugin_dir_path( __FILE__ ).'images/icons');
      return $path;
    }
    add_filter( 'wp_mime_type_icon','mobgen_myme_icon', 10,3 );

    results white a icon .txt file
    Warning: opendir(/xx/wptest.mobron.nl/wp-includes/images/media): failed to open dir: No such file or directory in /xx/wptest.mobron.nl/wp-includes/post.php on line 5308

    Notice: Undefined variable: icon in /xx/wptest.mobron.nl/wp-includes/post.php on line 5365

    and the .ged only white
    Notice: Undefined variable: icon in /xx/wptest.mobron.nl/wp-includes/post.php on line 5365

    Thread Starter Hans

    (@hmobron)

    Hello BCworks,

    Sorry but my explanation was n’t clear. The other files has icon’s, only not the .ged file.

    When i dig into the page code, the other media file’s has a tag whit class “has-media-icon”. The .ged file is missing that.

    A .ged file is a simple text file whit export information from a family tree program.

    Thread Starter Hans

    (@hmobron)

    Oke thanks, That’s a big step forward. I also noticed that i used apply_filters instead off add_filter. Now it’s working ad my custom upload Media Library.

    But at de main Media Library now noting is showing, net even the text icon.

    function mobgen_myme_types($mime_types){
        $mime_types['ged'] = 'text/ged'; //Adding ged extension
    
        return $mime_types;
    }
    add_filter('upload_mimes', 'mobgen_myme_types', 1, 1);
    
    function mobgen_myme_icon($path, $mime, $id =0){
     
      if($mime == 'text/ged'){
        $path = PLUGIN_URL.'images/ged.png';
      }
      return $path;
    }
    add_filter( 'wp_mime_type_icon','mobgen_myme_icon', 10,3 );
    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    Its all working now.

    I reprogrammed $wpdb->get_col("select ID from $wpdb->posts where post_title LIKE '".$_REQUEST["start_letter"]."%' AND post_type='product' "); back in the script an removed ‘s’=> and replaced by post__in.

    When i have time a will search for the divrence between your script and mine.

    Thanks Hakkim and Finnj

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    Finj, now a have done it and is working now. :).

    But now something else. As you can see at my first post, i started whit this: $wpdb->get_col("select ID from $wpdb->posts where post_title LIKE '".$_REQUEST["start_letter"]."%' AND post_type='product' ");

    Later on the suggested to use ‘s’=>’s’. Now this way gave results whit all post whit a s in site and that is not what i want.

    I only want post title begin whit the letter s.

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    Thanks Finj, but no luck. All the pages are still the same. Even the last page, how has only ten products to list (the leftovers)

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    No did not help.

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    Oke i rewrite the hole thing and got now:

    global $wpdb;
         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
     // wp_reset_query();
    
    $args = array('s'=> $_REQUEST["start_letter"],
                  'post_type'=>'product',
                  'orderby'=>'title',
                  'order'=>'asc',
                  'product_tag'=>urldecode( $_REQUEST["product_tag"]),
                  'product_cat'=>urldecode( $_REQUEST["product_cat"]),
                  );
    
    query_posts( $args );
    
    $big = 999999999; // need an unlikely integer
    
    echo paginate_links( array(
      'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    	'format' => '?page=%#%',
        'posts_per_page'=>10,
        'paged=' => $paged,
      	'current' => max( 1, get_query_var('paged') ),
    	'total' => $wp_query->max_num_pages,
        'add_args' => array('start_letter'=>$_REQUEST["start_letter"],
                            'product_tag'=>urlencode ($_REQUEST["product_tag"]),
                            'product_cat'=>urlencode ($_REQUEST["product_cat"]),
                            'ZOEK' => 'Zoek'
    ) ));
      echo $wp_query->max_num_pages."-".$paged;

    When is set posts_per_page on 80, i got 80 results. $wp_query->max_num_pages is 0 all the time and there is no pages notation.

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    How can i search on only one or more start letters on title off a page?

    In a other forum the wrote this way because the like statement exists in wordpress. I read the codex page query_posts and figure it out how to do that.

    Forum: Hacks
    In reply to: paginate_links problem
    Thread Starter Hans

    (@hmobron)

    Hello Hakkim,

    Thats a good point, but is is there but outside the code that i copied.
    Thanks anyway.

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