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
| <?php | |
| // Exclude child categories of a category | |
| function excluded_child_cats($id) { | |
| // generates formatted string of sub cats | |
| $ex_cats = get_categories('child_of=' . $id); | |
| $result = ''; | |
| foreach ($ex_cats as $ec) { | |
| $result .= ' -' . $ec->cat_ID; | |
| } |
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
| <?php | |
| /** | |
| * Tests if any of a post's assigned categories are descendants of target categories | |
| * | |
| * @param int|array $cats The target categories. Integer ID or array of integer IDs | |
| * @param int|object $_post The post. Omit to test the current post in the Loop or main query | |
| * @return bool True if at least 1 of the post's categories is a descendant of any of the target categories | |
| * @see get_term_by() You can get a category by name or slug, then pass ID to this function | |
| * @uses get_term_children() Passes $cats |
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
| <?php | |
| // Deactivate wordpress autosave for a post type | |
| add_action( 'admin_enqueue_scripts', 'my_admin_enqueue_scripts' ); | |
| function my_admin_enqueue_scripts() { | |
| if ( 'your_post_type' == get_post_type() ) | |
| wp_dequeue_script( 'autosave' ); | |
| } |
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
| <?php | |
| // The follow will remove the updates, comments, new content and performance links from the admin bar if the user isn't the admin user. | |
| // On most WordPress blogs the admin user has the User ID of 1 so you can apply the following snippet. | |
| function remove_admin_bar_links() { | |
| global $wp_admin_bar, $current_user; | |
| if ($current_user->ID != 1) { | |
| $wp_admin_bar->remove_menu('updates'); // Remove the updates link | |
| $wp_admin_bar->remove_menu('comments'); // Remove the comments link | |
| $wp_admin_bar->remove_menu('new-content'); // Remove the content link | |
| $wp_admin_bar->remove_menu('w3tc'); // If you use w3 total cache remove the performance link |
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
| <?php | |
| // This code just searches for posts through setting the post_type. | |
| // You can also make it do the opposite by setting the post_type to pages, | |
| // so it only return pages in the search result. | |
| function SearchFilter($query) { | |
| if ($query->is_search) { | |
| $query->set('post_type', 'post'); | |
| } | |
| 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
| $(window).ready(function() { | |
| $("#slideshow ul").carouFredSel({ | |
| width: 650, // Alterar! Não esquecer de alterar no CSS também. | |
| height: 300, // Alterar! Não esquecer de alterar no CSS também. | |
| items: { | |
| visible: 1 | |
| }, | |
| prev: { | |
| button: '#slideshow .btn.left' | |
| }, |
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
| var msg=""; | |
| function clickIE() | |
| { | |
| if (document.all) | |
| { | |
| (msg); | |
| return false; | |
| } | |
| } |
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 disableselect(e) | |
| { | |
| return false; | |
| } | |
| document.onselectstart=new Function ("return false"); | |
| if (window.sidebar){document.onmousedown=disableselect; | |
| document.onclick=reEnable;} |
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
| find . ! -name one ! -name two -maxdepth 1 -type f -delete |
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
| // Make #main's height go to footer and fill up all the page | |
| jQuery(document).ready(function() { | |
| // Size that main have to be | |
| var mainPredefinedHeight = jQuery(window).height() | |
| - jQuery('#header').outerHeight(true) | |
| - jQuery('#footer').outerHeight(true) | |
| - parseInt(jQuery('#main').css('paddingBottom')) | |
| ; | |
| if( jQuery('#main').height() < mainPredefinedHeight) { |