This file contains hidden or 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
// Display Custom Post Types on home page, add to functions.php | |
add_filter( 'pre_get_posts', 'my_get_posts' ); | |
function my_get_posts( $query ) { | |
if ( is_home() && $query->is_main_query() ) | |
$query->set( 'post_type', array( 'news' ) ); //add cpt, in this case 'news' to array | |
return $query; |
This file contains hidden or 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
// Display categories for Custom Post Types, add to functions.php | |
add_filter('pre_get_posts', 'query_post_type'); | |
function query_post_type($query) { | |
if(is_category() || is_tag()) { | |
$post_type = get_query_var('post_type'); | |
if($post_type) | |
$post_type = $post_type; | |
else | |
$post_type = array('post','news'); //substitute cpt - in this case 'news' - for post type |
This file contains hidden or 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
<a href="pdf_server.php?file=pdffilename">Download my pdf</a> | |
// pdf_server.php | |
header("Content-Type: application/octet-stream"); | |
$file = $_GET["file"] .".pdf"; | |
header("Content-Disposition: attachment; filename=" . urlencode($file)); | |
header("Content-Type: application/force-download"); |
This file contains hidden or 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
if( !is_admin()){ | |
wp_register_script('thescript', get_template_directory_uri() . '/path/to/thescript.js', array('jquery'), '1.2.3', true ); | |
} | |
function conditional_scripts() { | |
if( !is_admin() && is_page('somepage') ){ | |
wp_enqueue_script('thescript'); | |
} | |
} |
This file contains hidden or 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
// in functions.php, check to see if there's more than one page: | |
function show_posts_pag() { | |
global $wp_query; | |
return ($wp_query -> max_num_pages > 1); | |
} | |
// on page:: | |
<?php if (show_posts_pag()) : ?> |
This file contains hidden or 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
function my_scripts_method() { | |
wp_deregister_script( 'jquery' ); | |
wp_register_script( 'jquery', get_template_directory_uri() . '/js/jquery-new.js'); | |
wp_enqueue_script( 'jquery' ); | |
} | |
add_action('wp_enqueue_scripts', 'my_scripts_method'); |
This file contains hidden or 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
// zip -e [archive] [file] | |
zip -e archivename.zip filetoprotect.txt |
This file contains hidden or 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
// Makes sure the branch gets tracked upstream | |
git push -u origin my_branch |
This file contains hidden or 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
cd wordpress | |
git fetch --tags | |
git checkout 3.5.1 |