GitHub Gist Shortcode

  • Unknown's avatar

    Hate to be Debbie Downer, but given the time and ‘vote count’, combined with the lack of response from WPCOM staff at this point, is this hopeless?

  • Unknown's avatar

    FWIW, I would love to have this feature.

  • Unknown's avatar

    Thanks for the feedback so far everyone. I’ll post this request in our user suggestion list. Keep the votes coming if you are interested and haven’t already left a reply on this thread.

  • Unknown's avatar

    @designsimply – is that ‘user suggestion list’ public? (like on uservoice or something?) Is there anything we can do to help make it happen outside of adding comments? Does it make a difference if we’re paid users?

  • Unknown's avatar

    Hi guys,

    Gist would be a great service to support so I’ve tossed together some code to allow embedding.

    Here’s the valid formats to embed gists:

    https://gist.github.com/2314628
    
    
    <?php
    $query_args = array(
    'foo' => 'bar',
    'apple' => 'orange',
    'posts_per_page' => 50,
    'offset' => 0,
    );
    $some_posts = new WP_Query( $query_args );
    while ( $some_posts->have_posts() ) {
    /*
    * Do some stuff here
    */
    // Get more posts
    $query_args['offset'] = $query_args['offset'] + $query_args['posts_per_page'];
    $some_posts = new WP_Query( $query_args );
    }
    view raw gistfile1.aw hosted with ❤ by GitHub
    [gist 2314628 /] [gist https://gist.github.com/2314628 /] [gist]2314628[/gist] [gist]https://gist.github.com/2314628[/gist]

    Those first two are URLs on their own lines, not hyperlinked (clickable). You can also go the shortcode route if you prefer (the last four examples).

  • Unknown's avatar

    @designsimply – is that ‘user suggestion list’ public? (like on uservoice or something?) Is there anything we can do to help make it happen outside of adding comments? Does it make a difference if we’re paid users?

    manningj, the list isn’t public. Comments are the way to go. It doesn’t make a difference about being a paid user or not. Sometimes we can get new features added, sometimes not–it depends on a lot of factors. :)

    As you can see… viper007bond added a gist shortcode for you guys! w00t!

    viper007bond, thank you. :)

  • Unknown's avatar

    Awesome viper007bond – thanks!

    Is there any way to specify an individual file within a gist? For example, I have this embed code for a single line of HTML which I’d love to embed within a post, in addition to other snippets from the same gist:


    <script src="https://gist.github.com/2362963.js?file=button1.html"></script>

    Thanks again – even without the individual file selection this is a great update.

  • Unknown's avatar

    Sure, no problem. Use the “file” shortcode parameter to do it. Examples:

    [gist https://gist.github.com/2372005 file="file2.php" /]
    
    [gist file="file2.php"]https://gist.github.com/2372005[/gist]
  • Unknown's avatar

    Thanks again viper007bond – I’ve tried this and it works great. Much appreciated!

  • Unknown's avatar
  • The topic ‘GitHub Gist Shortcode’ is closed to new replies.