Forum Replies Created

Viewing 15 replies - 31 through 45 (of 247 total)
  • Plugin Author Chris

    (@zenation)

    Nope. This plugin is mainly for finding videos based on dynamic search terms. Usually, the results are like a million times better for matching stand-alone video(s) than for playlists. YT seems to only try to match the playlist titles against search terms – which is almost never “the best” you can get.

    If you want to embed specific playlists or channels you might try “Youtube Channel Gallery” or one of these plugins https://www.ads-software.com/plugins/tags/youtube-playlist.

    Plugin Author Chris

    (@zenation)

    Hi again.
    I’ve added a widget option “Hide on” that allows you to have a comma separated list of numeric post IDs. On those post the widget will not show up.

    You can also add page IDs since under the hood it’s all the same for WordPress.

    And it’s implemented in the latest plugin version v1.9.0.

    Plugin Author Chris

    (@zenation)

    Hi and thanks for the feedback.
    Unfortunately I see no way other than using something like Widget Logic at the moment.

    Though I do remember testing the implementation of a kind of black list for post IDs. But I’m not quite sure why I dropped it. Maybe there were consecutive issues or maybe it was simply impractical or maybe I just forgot to finish it? I will look into it over the weekend and get back to you.

    Plugin Author Chris

    (@zenation)

    You can use the duration parameter and set it to long, medium, short.

    [relatedYouTubeVideos ... duration="long"]

    You cannot set a specific number of minutes, though.

    As for the Amazon affiliate links: A basic implementation wouldn’t be that hard. But it would be out of the scope for this plugin and therefore I won’t implement it.

    But feel free to base another plugin on this one and extend the functionality to your needs.

    Plugin Author Chris

    (@zenation)

    Hi,

    you can either set width and height as paramter:
    [relatedYouTubeVideos relation="postTitle" max="1" width="480" height="360"]

    or customize the CSS of your theme, eg

    ul.relatedYouTubeVideos li {
       width:  480px;
       height: 360px;
    }

    But if you mean the quality of the video itself (720p or whatever), that’s something you can’t control or enforce. Youtube will send the quality it thinks you can handle – according to your internet connection.

    Plugin Author Chris

    (@zenation)

    Generally speaking, you can use the “offset” parameter for that. Though this will only work properly when you’re using the shortcode, not the widget, for you will have to have different offset values on different pages. But with the shortcode you could do it like this:

    On page 1 insert the shortcode [relatedYouTubeVideos relation=”keywords” terms=”monty python” preview=”true” max=”2″ offset=”0″]

    On page 2 insert the shortcode [relatedYouTubeVideos relation=”keywords” terms=”monty python” preview=”true” max=”2″ offset=”5″]

    On page 3 insert the shortcode [relatedYouTubeVideos relation=”keywords” terms=”monty python” preview=”true” max=”2″ offset=”10″]

    Plugin Author Chris

    (@zenation)

    Generally speaking, this is done using CSS (media queries). Eg something like this:

    @media screen and (max-width: 800px) {
    
      ul.relatedYouTubeVideos {
        display:      block;
        margin:       1em auto;
      }
    
      ul.relatedYouTubeVideos li,
      ul.relatedYouTubeVideos img,
      ul.relatedYouTubeVideos object {
        display:      block;
        width:        100%;
        height:       auto;
      }
    
      ul.relatedYouTubeVideos li {
        padding:      1em 0;
        text-align:   center;
      }
    
    }

    The exact CSS will depend on the theme you’re using, especially if the content container is already responsive, etc. You also might have to add a !important here and there before the semicolons to make sure the rule won’t be overwritten.

    Plugin Author Chris

    (@zenation)

    Hi,
    there is no setting to disable caching.

    I’ve decided to enforced this because even if you have multiple keys or you’re on a payment plan, it still takes precious time to call the Youtube webservice. Waayy more time than handling local cache files.

    So it’s a way to a) minimize your costs by minizing the number of requests and b) to boost your website’s loading time – which users and Google are very fond of.

    If you still do want to disable the caching you would have to edit one the PHP files:

    Go to …wp-content/plugins/related-youtube-videos/lib/RelatedYoutubeVideos/API.php and look for the line

    @file_put_contents( $cacheFile, json_encode( $result ) );

    It’s round about line 221. And either delete it or turn this into a comment like

    // @file_put_contents( $cacheFile, json_encode( $result ) );

    Plugin Author Chris

    (@zenation)

    Hi,
    generally speaking there is no limit of terms or keywords you can use.
    But the API is also more restricted for us than for YouTube itself.

    You can run some tests on https://developers.google.com/youtube/v3/docs/search/list#try-it if you like. Just enter “snippet” in the “part” field, and your list of keywords into the “q” field. You can then see what the API results are.

    If there are no results for your keywords then I’m afraid I can’t do anything. If you DO get results on this demo site but not with the plugin I will have to take a closer look at my code and check if there’s something wrong.

    You can also pack the function itself into its own php file and load it via include_once( 'func.crw_install.php' );

    But PHP won’t mind if the conditional isn’t met.

    I don’t know if there’s a better way other than yours. But you could always wrap your function into a conditional

    if ( !function_exists( 'crw_install' ) ) {
       function crw_install( $network_wide = null ) {
       ...
       }
    }
    register_activation_hook( CRW_PLUGIN_FILE, 'crw_install' );

    This way the function is only declared once.

    Ha. I didn’t know about not using print_style any longer. You never stop learning. Your code look fine now ??

    I’m not a big fan of using globals. Though in your case it’s just semantics. Instead you could create an object where your admin page hook is a member variable that can be referenced by each function/method. But again, this would be a clean up (in terms of “separation of concerns”) but not an improvement.

    I would go back one step. This might look like quite some overhead at first. But I think in the end this is the cleanest approach.

    /**
     * Step 1: Register your CSS file
     */
    function myCustomAdminInit() {
    
      wp_register_style( 'myCustomAdminStyles', '../your.css' );
    
    }
    add_action( 'admin_init', 'myCustomAdminInit' );
    
    /**
     * Step 2: This is how it will be loaded
     */
    function loadMyCustomAdminStyles() {
    
      wp_enqueue_style( 'myCustomAdminStyles' );
    
    }
    
    /**
     * Step 3: Add your admin pages
     */
    function registerMyCustomAdminPages() {
    
      // Create your "wpgel-localseo" menu/page here
    
      $pages['index']   = add_menu_page( ... );
    
      $pages['options'] = add_submenu_page( ... );
    
      // Of course, if you only have one page you won't need the foreach
      foreach( $pages as $page ) {
    
        // Finally, this is the line you're looking for...
        add_action( 'admin_print_styles-' . $page, 'loadMyCustomAdminStyles' );
    
      }
    
    }
    add_action( 'admin_menu', 'registerMyCustomAdminPages' );

    Also, if you do var_dump( do_shortcode( $str ) ); instead of echo do_shortcode($str); you can see that the square brackets have been replaced.

Viewing 15 replies - 31 through 45 (of 247 total)