This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Register WordPress theme settings ******************************************/ | |
/* Navigation menus -----------------*/ | |
register_nav_menus( array( | |
'primary' => 'Principal' | |
)); | |
/* Images ---------------------------*/ | |
add_theme_support( 'post-thumbnails' ); | |
/* Sidebars -------------------------*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SimplestWidget_Widget extends Strx_Widget { | |
function w_id(){ return 'simplest-widget'; } | |
function w_name(){ return 'My Simplest Widget'; } | |
/** Return the dashboard admin form */ | |
function w_form($instance){ | |
return '<p>'.$this->w_form_input($instance, 'title').'</p>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hook into wordpress search function | |
add_filter( 'the_search_query', 'aggregated_search' );// Define what post types to search | |
function aggregated_search( $query ) { | |
if( $query->is_search ) { | |
$query->set( 'post_type', array( 'post', 'page', 'feed', 'attachment', 'movies', 'quotes' ));//define search types | |
} | |
return $query; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Initialize the Class and add the action | |
add_action('init', 'pTypesInit'); | |
function pTypesInit() { | |
global $sites; | |
$sites = new TypeSites(); | |
} | |
// Create a post type class for 'Site' posts | |
// To use as a bookmarking post type for sites you want to save/share. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Create a post type class for site posts | |
// To use as a bookmarking post type for sites you want to save/share. | |
class TypeSites { | |
public $meta_fields = array( 'title', 'description', 'siteurl', 'category', 'post_tags' ); | |
public function TypeSites() { | |
$siteArgs = array( | |
'labels' => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$q = new WP_query(); | |
$q->query( 'post_type=site' ); | |
/* Begin the Loop */ | |
if ($q->have_posts()) : | |
while ($q->have_posts()) : $q->the_post(); | |
/** | |
* Now instantiate the Sites class we made in posttypes.php setting the $s variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The base configurations of the WordPress. | |
* | |
* This file has the following configurations: MySQL settings, Table Prefix, | |
* Secret Keys, WordPress Language, and ABSPATH. Get MySQL settings from web host. | |
* You can find more information by visiting the Codex page: | |
* | |
* @link http://codex.wordpress.org/Editing_wp-config.php | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ------------------------------------------------------------------ | |
// Add all your sections, fields and settings during admin_init | |
// ------------------------------------------------------------------ | |
// | |
function eg_settings_api_init() { | |
// Add the section to reading settings so we can add our fields to it | |
add_settings_section('eg_setting_section', 'Example settings section in reading', 'eg_setting_section_callback_function', 'reading'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WordPress_Settings | |
{ | |
/** | |
* | |
* @var array | |
*/ | |
protected $_registry; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('restrict_manage_posts','restrict_manage_movie_sort_by_genre'); | |
function restrict_manage_movie_sort_by_genre() { | |
if (isset($_GET['post_type'])) { | |
$post_type = $_GET['post_type']; | |
if (post_type_exists($post_type) && $post_type=='movie') { | |
global $wpdb; | |
$sql=<<<SQL | |
SELECT pm.meta_key FROM {$wpdb->postmeta} pm | |
INNER JOIN {$wpdb->posts} p ON p.ID=pm.post_id | |
WHERE p.post_type='movie' AND pm.meta_key='Genre' |