Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
andrewlimaza / example_pmpro_has_membership.php
Created December 20, 2016 13:59
Example of pmpro_hasMembershipLevel() usage
<?php
//You may either create a function or place this code in a custom page template.
//Find more here -> https://www.paidmembershipspro.com/documentation/content-controls/require-membership-function/
if( is_user_logged_in() ){
if( pmpro_hasMembershipLevel( 'silver' ) ){
//show this for 'silver level'
@kellenmace
kellenmace / get-the-excerpt-by-post-id-in-wordpress.php
Created September 6, 2016 18:13
Get the Excerpt by Post ID in WordPress
<?php
/**
* Return the post excerpt, if one is set, else generate it using the
* post content. If original text exceeds $num_of_words, the text is
* trimmed and an ellipsis (…) is added to the end.
*
* @param int|string|WP_Post $post_id Post ID or object. Default is current post.
* @param int $num_words Number of words. Default is 55.
* @return string The generated excerpt.
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@gokulkrishh
gokulkrishh / media-query.css
Last active April 24, 2024 17:27
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */