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
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^/?basic/(.*)$ /basic/index.php/$1 [L] |
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 to functions.php within the theme folder. | |
function create_my_taxonomies() { | |
register_taxonomy('actors', 'post', array( | |
'hierarchical' => false, 'label' => 'Actors', | |
'query_var' => true, 'rewrite' => true)); | |
register_taxonomy('producers', 'post', array( | |
'hierarchical' => false, 'label' => 'Producers', | |
'query_var' => true, 'rewrite' => true)); | |
} |
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
<title> | |
<?php if (function_exists('is_tag') && is_tag()) { | |
single_tag_title('Tag Archive for "'); echo '" - '; | |
} elseif (is_archive()) { | |
wp_title(''); echo ' Archive - '; | |
} elseif (is_search()) { | |
echo 'Search for "'.wp_specialchars($s).'" - '; | |
} elseif (!(is_404()) && (is_single()) || (is_page())) { | |
wp_title(''); echo ' - '; | |
} elseif (is_404()) { |
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 this to your functions.php: | |
<?php add_action('admin_menu', 'add_gcf_interface'); | |
function add_gcf_interface() { | |
add_options_page('Global Custom Fields', 'Global Custom Fields', '8', 'functions', | |
'editglobalcustom elds'); | |
} | |
function editglobalcustom elds() { ?> | |
<div class="wrap"> | |
<h2>Global Custom Fields</h2> | |
<form method="post" action="options.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 if (have_posts()) : ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<div class="post" id="post-<?php the_ID(); ?>"> | |
<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> | |
<?php echo get_post_meta($post->ID, 'PostThumb', true); ?> |
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
// To check what query string is being used by the Loop | |
// insert before the loop. | |
<?php echo "<pre>"; print_r($wp_query->query_vars); echo "</pre>"; ?> |
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
// when adding a custom field to a page, you can check its value like this: | |
<?php // e.g conditional sidebar display | |
if (!get_post_meta($post->ID, "noSidebar", true)) { | |
get_sidebar(); | |
} ?> |
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 WordPress Loop - customized with query_posts | |
global $query_string; // grab the global query information | |
$posts = query_posts($query_string.'&cat=-9'); // exclude Asides category | |
if (have_posts()) : while (have_posts()) : the_post(); | |
... | |
endwhile; else: | |
... | |
endif; | |
wp_reset_query(); // reset the 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 // The WordPress Loop - customized with WP_Query | |
$custom_query = new WP_Query('cat=-9'); // exclude Asides category | |
while($custom_query->have_posts()) : $custom_query->the_post(); | |
... | |
endwhile; | |
wp_reset_postdata(); // reset the query | |
?> | |
// more examples | |
<?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 // Loop 1 | |
$ rst_query = new WP_Query('cat=-1'); // exclude category | |
while($ rst_query->have_posts()) : $ rst_query->the_post(); | |
... | |
endwhile; | |
wp_reset_postdata(); // reset the query | |
// Loop 2 | |
$second_query = new WP_Query('cat=-2'); // exclude category | |
while($second_query->have_posts()) : $second_query->the_post(); | |
... |
OlderNewer