Skip to content

Instantly share code, notes, and snippets.

$type= post_type;
$name=posts;
function referring_url_box ( 'post_type', 'post') {
pods_group_add( 'posts', 'Referring URL', 'referring_url_name, referring_url' );
}
$type= post_type;
$name=post;
function referring_url_box ( $type, $name) {
pods_group_add( 'post', 'Referring URL', 'referring_url_name, referring_url' );
pods_group_add( 'post', 'Downloads', 'download_name, download_location' );
pods_group_add( 'post', 'Contact', 'contact_name, contact_url' );
}
$('html,body').animate({
scrollTop: $('a[href*="' + window.location.hash.replace('#','') + '"]').eq(0).offset().top - top_offset
}, 400)
window.location.hash = '/';
$('li.active').removeClass('active loading');
$article.remove();
})
@LinzardMac
LinzardMac / PHP
Created February 17, 2013 23:17
Get the facebook access token
$catray[] = $categorize;
$access = file_get_contents('https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=' . $clientid . '&client_secret=' . $clientsecret . '');
$token = str_replace('access_token=', '', $access);
// Fire the Hfbp request to Twitter
$response[] = 'https://graph.facebook.com/' . $pageid . '?fields=statuses.fields(from,id,message)&access_token='.$token;
// Filter wp_nav_menu() to add link to recent lottery
function new_nav_menu_items($items) {
// Get the most recent post
$the_query = new WP_Query( 'posts_per_page=1' );
// Pull the excerpt
while ( $the_query->have_posts() ) : $the_query->the_post();
$latest_link = '<li> <a href="' . get_permalink() . '>Lotteries</a></li>';
endwhile;
$items = $latest_link . $items;
return $items;
@LinzardMac
LinzardMac / gist:5103629
Created March 6, 2013 22:18
Adding a link that gets the recent post from a CPT and putting it in a specified menu
// Filter wp_nav_menu() to add link to recent lottery
function new_nav_menu_items($items) {
// Get the most recent post
$the_query = new WP_Query( 'post_type=toy_lotteries' , 'posts_per_page=1' );
// Pull the link
while ( $the_query->have_posts() ) : $the_query->the_post();
$latest_link = '<li> <a href="' . get_permalink() . '">Lotteries</a></li>';
endwhile;
$items = $latest_link . $items;
return $items;
class description_walker extends Walker_Nav_Menu
{
/**
* Start the element output.
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. May be used for padding.
* @param array $args Additional strings.
<ul id="menu-main-nav" class="nav-menu"><li id="nav-menu-item-17" class="main-menu-item menu-item-even menu-item-depth-0 about menu-item menu-item-type-post_type menu-item-object-page"><a href="http://nsr.dev/about-us/" data-description="Our Story" class="menu-link main-menu-link">About Us</a><small class="nav_desc">Our Story</small>
<ul class="sub-menu menu-odd menu-depth-1">
<li id="nav-menu-item-34" class="sub-menu-item menu-item-odd menu-item-depth-1 menu-item menu-item-type-post_type menu-item-object-page"><a href="http://nsr.dev/about-us/about-sub-page/" class="menu-link sub-menu-link">History</a></li>
<li id="nav-menu-item-32" class="sub-menu-item menu-item-odd menu-item-depth-1 menu-item menu-item-type-post_type menu-item-object-page"><a href="http://nsr.dev/about-us/values-mission/" class="menu-link sub-menu-link">Values &amp; Mission</a></li>
<li id="nav-menu-item-33" class="sub-menu-item menu-item-odd menu-item-depth-1 menu-item menu-item-type-post_type menu-item-object-page"><a href="http
// Schedules an event
function fbp_create_schedule2() {
global $fbp_opts;
$recurrence = isset($fbp_opts['recurrence']) ? $fbp_opts['recurrence'] : 'hourly';
$schedule = wp_get_schedule('fbp_statuses_to_posts');
$author_id = isset($fbp_opts['author']) ? $fbp_opts['author'] : 0;
$author = get_user_by('id', $author_id);
// Clear the schedule if recurrence was changed
if($schedule != $recurrence) {
wp_clear_scheduled_hook('fbp_statuses_to_posts');
foreach($statusesray as $status)
{
if($status->type=="status")
{
do stuff
}
// this echos "photo" which is expected when the type == photo
echo $status->type;