Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter David

    (@topsquirrel)

    Thanks for the tip, much appreciated ??

    David

    (@topsquirrel)

    Same for me too

    David

    (@topsquirrel)

    For me, I upgraded to 1.3.0 and haven’t noticed the problem yet so tentatively ?? thanks.

    Thread Starter David

    (@topsquirrel)

    Hi,

    Jan – thanks, but I couldn’t get the PDFs to show just using your plugin. I’m using your plugin otherwise, which is great, together with my code above to do the PDF search though ??

    bcsdphelps – sorry, yes I’m also using MimeTypes Link Icons by Toby Cox to add the PDF icon and size the attachment and provide the class mtli_attachment mtli_pdf. Apologies for not mentioning that. Hope that helps

    Best
    David

    David

    (@topsquirrel)

    Same for me version 1.2.0 WordPress 4.5.3

    Thread Starter David

    (@topsquirrel)

    I’ve written a function to list PDF attachments based on a MCM custom category and a search of post title (attachment title). It’s based on a shortcode eg. [WP_MCM_PDF cat=”results” find=”%hard%30%”]

    Function code is below if it’s of use to anyone…

    // WP_MCM_PDF shortcode to display PDF attachments list by custom MCM category and a search on title
    // DJB August 2016
    // example usage [WP_MCM_PDF cat="results" find="%hard%30%"]
    add_shortcode( 'WP_MCM_PDF', 'MCM_PDF_List_Function' );
    function MCM_PDF_List_Function($atts, $content="null"){
      extract(shortcode_atts(array('cat' => '', 'find' => ''), $atts));
      global $wpdb;
      $FindPostTitle=strtoupper($find);
      //
      // sql query
      $results = $wpdb->get_results("SELECT p.post_name my_name, p.guid my_guid, p.post_title my_title  FROM $wpdb->posts p, $wpdb->term_relationships r, $wpdb->term_taxonomy tt, $wpdb->terms t
      WHERE p.post_mime_type = 'application/pdf' AND upper(p.post_title) like upper('$FindPostTitle') AND
      r.object_id = p.id AND
      tt.term_taxonomy_id = r.term_taxonomy_id AND tt.taxonomy = 'media_category' AND
      t.term_id = tt.term_id AND t.name = '$cat' ORDER BY p.post_name DESC ", OBJECT);
      //
      // loop through results
      if ( $results ) {
        foreach ( $results as $attachment ) {
      ?>
          <div class="entry-content" itemprop="articleBody">
            <a href='<?php echo $attachment->my_guid; ?>' rel="bookmark" title='<?php echo $attachment->my_title; ?>' class='mtli_attachment mtli_pdf'>
              <p class="entry-title" itemprop="name headline"><?php echo $attachment->my_title; ?></p>
            </a>
          </div>
      <?php
        }
      }
      else
      {
      	echo "no attachments found";
      }
    }
    Thread Starter David

    (@topsquirrel)

    I like the plugin, the idea is really good but I couldn’t get the slideshow to work and got nowhere with any of the other plugins either so I downloaded JQuery Cycle (Cycle2 also works fine)and put it here… /plugins/category-grid-view-gallery/js/jquery.cycle.js

    I enqueued the script in theme/functions.php

    add_action('wp_print_scripts', 'wp_cycle2_scripts');
    function wp_cycle2_scripts() {
    	if(!is_admin())
    	wp_enqueue_script('cycle', WP_CONTENT_URL.'/plugins/category-grid-view-gallery/js/jquery.cycle.js', array('jquery'), '', true);
    }

    This worked straight away after I did a CSS change to set the height of the slideshow container (can’t recall the div) to greater than zero.

    I’ve also hacked the Category Grid View Gallery Plugin and renamed it to keep my mods.

    Thread Starter David

    (@topsquirrel)

    By the way, example is here https://fresh.squirrelhouse.biz/?page_id=73

    Thanks

Viewing 8 replies - 16 through 23 (of 23 total)