• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WPGist

WordPress Gist and Snippets Collection

  • Home
  • Gists
  • Blog
  • Contact us
  • Submit

All WordPress Gists and Snippets

Find all WordPress Gists and Snippets at one place. This ultimate collection of WordPress Gists is created and submitted by WordPress community and users.

Create a WordPress While Loop

By Rogger Shaw 1 Comment

List posts in a WordPress while loop. Usage: When you need to create a WordPress Loop, you can create a while loop.

Filed Under: Gists

Enqueue WordPress Scripts and Styles

By Rogger Shaw Leave a Comment

Different ways to enqueue WordPress scripts and styles. Usage: Enqueue scripts and styles from parent or child themes, and even external links.

Filed Under: Gists

Get Post Info by Slug

By Rogger Shaw Leave a Comment

Pull the ID first, then you’ll have access to the post’s data. Usage: If you only have a post’s slug, you can easily get the ID of it, and than pull that post’s info. Useful for when you can only get a post’s slug, but need to get more info for that post.

Filed Under: Gists

Get Image URL from Image ID

By Rogger Shaw Leave a Comment

Get the URL of an Image by the ID. Usage: If you need to get the URL for a Media Image uploaded, you’ll first need to know the ID of the image. What sucks about this is – with this approach you will either to know the Image ID specifically. There is another way to […]

Filed Under: Gists

Create a Search Shortcode

By Rogger Shaw Leave a Comment

Add a Search Shortcode to a Page/Post and even in a Template Usage: Add a Search form to your Post Content (Post -> Editor -> Text Tab) or to a template via do_shortcode.

Filed Under: Gists

Create a WordPress Foreach Loop

By Rogger Shaw Leave a Comment

List posts in a foreach loop. Usage: When you need to create a WordPress Loop, you can create a foreach loop.

Filed Under: Gists

Primary Sidebar

  • Facebook
  • Twitter

Latest Gists

  • Create a WordPress While Loop
  • Enqueue WordPress Scripts and Styles
  • Get Post Info by Slug
  • Get Image URL from Image ID
  • Create a Search Shortcode

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

© 2025 · WPGist · All rights reserved · A Project of WPArena.com