CALL (239) 961-8285
ENDURTECH
  • Web Services
    • Web Design
      • Design and Development
      • Web Consulting and Tutoring
      • Hosting and Maintenance
      • Project Portfolio
    • Media
      • Photo and Audio, Video Editing
      • Social Media Management
      • All Web Related Services
    • Marketing
      • Digital Marketing and Branding
      • Search Engine Optimization
    • Client Portal
      • Remote Web Support
      • Web Services Payment
      • Scheduled Payments
  • Tech Support
    • Services
      • Computer Support and Repair
      • Data Backup and Recovery
      • Computer Security, Virus Removal
      • Computer Networking Support
      • Computer Consulting & Tutoring
      • All Technology Related Services
    • Blockchain
      • Blockchain Technology
      • Cryptocurrency Articles
    • Client Portal
      • Remote PC Support
      • Remote Monitoring & Management
      • Tech Services Payment
  • Articles
  • About
  • Talk to Me
  • Menu Menu

How to Embed a Specific Gist File into WordPress

Github, Web Site Support, WordPress

From time to time I have posted some handy code snippets to help you alter and enhance your WordPress web site. I have been inserting them as <pre> formatted text or using the <code> formatting option from within the WordPress classic editor menu.

At the time, this was the most expedient way of getting the code displayed within my article or post. However, many visitors simply copy and paste these pre-formatted snippets which can result in formatting or other issues.

To help save time and frustration on behalf of my visitors I am now providing my WordPress code snippets through my GitHub Gist account, a free service provided by GitHub. Please allow me some time to complete this task for all of my prior articles and posts. I have to manually transfer all these WordPress code snippets over to my GitHub Gist account while ensuring proper formatting. Then they have to be manually embedded back into their proper places with my articles and posts.

In this article I will show you how to embed your own GitHub Gists into your WordPress website article post or page. This will also work for other sites that permit embedded JavaScript.

 

Embed a Gist File #

While adding the first few Gists to my article posts, I discovered an issue with embedding them. Many of my code snippets were split into different files within my Gist and I wanted to access them individually, for various reasons. However, using the embed feature from the Gist website would not allow this. Rather it would embed the entire Gist and all of the files within it at once.

To get the embed code, click the clipboard icon next to the Embed URL of a Gist. To embed a specific Gist file, append the Embed URL with ?file=FILENAME

 

GitHub Gist File Embed Script

 

The instructions (above) for embedding a gist was straight forward enough but something was missing. I copied the Gist FILENAME I wanted to specifically post by right clicking on the filename and coping the link. But when we did as instructed the Gist embed would fail. Coping and pasting the Gist provided file URL was the issue! See example below:

 

GitHub Gist File Embedding into WordPress

 

If you copy a specific Gist file URL you get a link to the specific file:

  • https://gist.github.com/endurtech/0016602#file-remove-replace-discussion-metabox-php

Attempting to append #file-remove-replace-discussion-metabox-php to the embed URL script won’t work.

[su_list icon=”icon: close” icon_color=”#ff0000″]

  • <script src=”https://gist.github.com/endurtech/0016602.js#file-remove-replace-discussion-metabox-php“></script>

[/su_list]

You’ll need to manually adjust that URL, see example below:

[su_list icon=”icon: check” icon_color=”#15ae34″]

  • <script src=”https://gist.github.com/endurtech/0016602.js?file=remove-replace-discussion-metabox.php“></script>

[/su_list]

Notice the small differences? You have to switch the “#” for “?” and “file-” to “file=” as well as the file’s extension of “-php” to “.php”

Making these adjustments to the URL allowed me to embed any specific Gist. Hope this all made sense!

It is a bit time consuming to have to manually adjust each embedded script. But I think it’ll be worth it since it displays the code beautifully and allows visitors to easily copy the code.

Embedded Gist Example #

 

Embed a Gist on WordPress.com #

If you are using a WordPress.com powered website, they have created a handy and simple shortcode to help you embed your Gist files. Visit their Gist shortcode support article on how to utilize it.

 

End of File #

I welcome your thoughts, questions or suggestions on my article on embedding a specific GitHub Gist file on your web site.

You may support my work by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.

Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.

 

July 17, 2019
Share this entry
  • Share on Facebook
  • Share on X
  • Share on WhatsApp
  • Share on LinkedIn
  • Share on Reddit
  • Share by Mail
https://endurtech.com/wp-content/uploads/2019/07/github-logo.jpg 512 512 Manny https://endurtech.com/wp-content/uploads/2018/04/endurtech-logo.png Manny2019-07-17 15:14:232025-11-12 15:54:14How to Embed a Specific Gist File into WordPress
Search Search

CONNECT WITH US

This field is for validation purposes and should be left unchanged.
Engagement*

Want to say, "thanks"?
Leave me a review on Facebook and/or Google.

You can send me a tip using your Brave browser. Get Brave!

Only used to send you a receipt.
Include a Message
Popular
  • Windows Logo
    Second Monitor on Windows 10 Resets After SleepJuly 2, 2020 - 6:30 am
  • Windows Logo
    How to Disable the F1 Help Key in Windows 10April 15, 2021 - 2:40 pm
  • Cortana Logo
    How to Disable Microsoft’s CortanaApril 6, 2021 - 9:00 am
  • Firefox Logo
    How to Remove All Passwords from Lockwise in FirefoxMarch 26, 2020 - 11:00 am
Recent
  • How to Fix Brother BrLog Errors
    How to Fix Brother BrLog ErrorsAugust 24, 2026 - 10:55 am
  • How to block Facebook crawler
    List of Spider Crawlers to BlockAugust 10, 2026 - 9:20 am
  • Brave Browser Logo
    How to Fix the “Not Secure” Address Bar Err...July 20, 2026 - 12:48 pm
  • Linkpull Extension By Endurtech
    LinkPull Extension, Grab Any File From a URLJuly 7, 2026 - 7:35 pm

STAY IN TOUCH

ENDURTECH Web Design Company Naples, Florida

Endurtech GitHub ProfileEndurtech YouTube ChannelEndurtech LinkedIn ProfileEndurtech Facebook Page

5 Star Google Review for Endurtech - Naples Web Design Company

Learn More & Connect

Search Search
ENDURTECH Logo
Endurtech GitHub ProfileEndurtech YouTube ChannelEndurtech LinkedIn ProfileEndurtech Facebook Page

5 Star Google Review for Endurtech - Naples Web Design Company

Latest Articles

  • How to Fix Brother BrLog Errors
    How to Fix Brother BrLog ErrorsAugust 24, 2026 - 10:55 am
  • How to block Facebook crawler
    List of Spider Crawlers to BlockAugust 10, 2026 - 9:20 am
  • Brave Browser Logo
    How to Fix the “Not Secure” Address Bar ErrorJuly 20, 2026 - 12:48 pm
  • Linkpull Extension By Endurtech
    LinkPull Extension, Grab Any File From a URLJuly 7, 2026 - 7:35 pm

Recent Projects

  • Jewelry Website Gems of Note
    Gems of NoteNovember 15, 2019 - 10:16 pm
  • Gift Store Facebook Business Page Cover Video
    Gift Store Facebook Business Page Cover VideoApril 13, 2019 - 3:58 pm
  • Toledo Yoga BrandBot Footer Integration
    Toledo YogaApril 9, 2019 - 7:26 am
  • Lawyer Association Website with Member Portal
    National Employment Lawyers Association, Florida ChapterFebruary 26, 2019 - 8:00 am

Business Details

Mondays - Fridays
9:00 am - 5:00 pm
Eastern Standard Time
After hours by appointment

SUPPORT PHONE

(239) 961-8285

MAILING ADDRESS

59 Logan Ln.
Lynchburg, VA 24502

Copyright © 2026 ENDURTECH ® All Rights Reserved. Legal
Link to: [FIXED] GoDaddy Prosites Sign in Issues Link to: [FIXED] GoDaddy Prosites Sign in Issues [FIXED] GoDaddy Prosites Sign in IssuesGoDaddy Pro Sites ManageWP Link to: Gravity Forms Custom User Registration Activation Page Link to: Gravity Forms Custom User Registration Activation Page Gravity Forms LogoGravity Forms Custom User Registration Activation Page
Scroll to top Scroll to top Scroll to top