Skip to content

Instantly share code, notes, and snippets.

@LinzardMac
LinzardMac / video-featured-first-image
Created January 20, 2014 16:51
Featured Image / First Image / Video A snippet that first checks if the post is a video, if so places the video in the header of the article. If not it then checks to see if there is a featured image, if so - display that, if not it checks for an embedded image if so - display that. If not, do nothing
It's not simply the strength of the magnetic field that matters, so much as the rate at which the field changes.
If you go from strong field to no field very quickly or vice versa, then the change in magnetic
flux can generate small voltages over wires, traces, etc. If the voltages are high enough, then they can cause damage
<?php
//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
$taxonomy = 'surgery_type';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
<?php
echo ' . $myvar. </br>';
echo ' </br>';
echo ' </br>';
echo ' . $myvar2. </br>';
?>
but I need to use it like this:
$params = array(
'orderby' => 't.menu_order ASC',
'limit' => 4,
);
$restaurants = pods( 'restaurant', $params );
while ( $restaurants->fetch() ) :
$name= $restaurants->field('name');
$permalink= $restaurants->field('permalink');
$blurb = $restaurants->field('blurb');
//all my html for the detail info here
//here it returns NULL
global $wp_query, $wp_registered_sidebars, $wp_registered_widgets;
var_dump ($wp_registered_sidebars);
$sidebar_contents = "";
ob_start();
dynamic_sidebar('top-util');
$sidebar_contents = ob_get_contents();
ob_end_clean();
return $sidebar_contents;
object(WP_Query)#364 (49) { ["query"]=> NULL ["query_vars"]=> array(0) { } ["tax_query"]=> NULL ["meta_query"]=> bool(false) ["queried_object"]=> NULL ["queried_object_id"]=> NULL ["request"]=> NULL ["posts"]=> NULL ["post_count"]=> int(0) ["current_post"]=> int(-1) ["in_the_loop"]=> bool(false) ["post"]=> NULL ["comments"]=> NULL ["comment_count"]=> int(0) ["current_comment"]=> int(-1) ["comment"]=> NULL ["found_posts"]=> int(0) ["max_num_pages"]=> int(0) ["max_num_comment_pages"]=> int(0) ["is_single"]=> bool(false) ["is_preview"]=> bool(false) ["is_page"]=> bool(false) ["is_archive"]=> bool(false) ["is_date"]=> bool(false) ["is_year"]=> bool(false) ["is_month"]=> bool(false) ["is_day"]=> bool(false) ["is_time"]=> bool(false) ["is_author"]=> bool(false) ["is_category"]=> bool(false) ["is_tag"]=> bool(false) ["is_tax"]=> bool(false) ["is_search"]=> bool(false) ["is_feed"]=> bool(false) ["is_comment_feed"]=> bool(false) ["is_trackback"]=> bool(false) ["is_home"]=> bool(false) ["is_404"]=> bool(false) ["is_com
// Include WP
define('WP_USE_THEMES', false);
in
// actually contains what you would expect
var_dump($wp_query);
//set it as a global (get same error with or without this set)
global $wp_query;
class WordpressHeader extends Module
{
include_once('/home/bscdevel/public_html/wirerackblog/wp-load.php');
// returns https://gist.github.com/Lindsayanng/5640605
var_dump($wp_query);
class WordpressHeader extends Module
{
public function hookDisplayHeader(){
if( !defined( 'WP_USE_THEMES' ) )
variable return from outside of class
object(WP_Query)#364 (49) { ["query"]=> NULL ["query_vars"]=> array(0) { } ["tax_query"]=> NULL ["meta_query"]=> bool(false) ["queried_object"]=> NULL ["queried_object_id"]=> NULL ["request"]=> NULL ["posts"]=> NULL ["post_count"]=> int(0) ["current_post"]=> int(-1) ["in_the_loop"]=> bool(false) ["post"]=> NULL ["comments"]=> NULL ["comment_count"]=> int(0) ["current_comment"]=> int(-1) ["comment"]=> NULL ["found_posts"]=> int(0) ["max_num_pages"]=> int(0) ["max_num_comment_pages"]=> int(0) ["is_single"]=> bool(false) ["is_preview"]=> bool(false) ["is_page"]=> bool(false) ["is_archive"]=> bool(false) ["is_date"]=> bool(false) ["is_year"]=> bool(false) ["is_month"]=> bool(false) ["is_day"]=> bool(false) ["is_time"]=> bool(false) ["is_author"]=> bool(false) ["is_category"]=> bool(false) ["is_tag"]=> bool(false) ["is_tax"]=> bool(false) ["is_search"]=> bool(false) ["is_feed"]=> bool(false) ["is_comment_feed"]=> bool(false) ["is_trackback"]=> bool(false) ["is_home"]=> bool(fa