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
// Change default 'Set featured image' text for any specific post type | |
add_action( 'current_screen', 'thisScreen' ); | |
function thisScreen() { | |
$currentScreen = get_current_screen(); | |
if( $currentScreen->post_type === "YOUR_POST_TYPE" ) { | |
add_filter( 'admin_post_thumbnail_html', 'new_html_text_for_feature_image' ); | |
} |
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 | |
// Add new custom hierarchical taxonomy with oops ways | |
add_action( 'init', 'new_hierarchical_taxonomy_type_for_cpt' ); | |
function new_hierarchical_taxonomy_type_for_cpt() { | |
$post_type = 'job-opening'; | |
$all_taxonomy = array('Department','Nature of Job', 'Qualification', 'Age', 'Location', 'Experience', 'CTC'); | |
foreach ($all_taxonomy as $single) { | |
$single = ucwords(strtolower(preg_replace('/\s+/', ' ', $single) )); |
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
$('.dropdown-toggle').click(function() { | |
var location = $(this).attr('href'); | |
window.location.href = location; | |
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
<?php | |
// Setup Connection | |
$server = 'localhost'; $username = 'root'; $password = ''; | |
# Connect to server | |
$conn = new MySQLi ($server, $username, $password); | |
if($conn->connect_error) { | |
die ('Connection Failed : ' . $conn->connect_error); | |
} | |
echo 'Connected to server.<br/>'; | |
?> |
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
add_filter('widget_text','execute_php',100); | |
function execute_php($html){ | |
if(strpos($html,"<"."?php")!==false){ | |
ob_start(); | |
eval("?".">".$html); | |
$html=ob_get_contents(); | |
ob_end_clean(); | |
} | |
return $html; | |
} |
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
// Override the default WP template system | |
add_filter('template_include', 'taxonomy_template'); | |
function taxonomy_template( $template ){ | |
if( is_tax('YOUR_TAXONOMY_NAME')){ | |
$template = plugin_dir_path( __FILE__ ) .'/templates/taxonomy-YOUR_TAXONOMY_NAME.php'; | |
} | |
return $template; | |
} |
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 as_custom_taxonomy_dropdown( $taxonomy ) { | |
$terms = get_terms( $taxonomy ); | |
if ( $terms ) { | |
printf( '<select name="%s" class="postform">', esc_attr( $taxonomy ) ); | |
foreach ( $terms as $term ) { | |
printf( '<option value="%s">%s</option>', esc_attr( $term->slug ), esc_html( $term->name ) ); | |
} | |
print( '</select>' ); | |
} | |
} |
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
/** Error reporting */ | |
global $wpdb; | |
$wpdb->show_errors(); | |
// For WordPress Multisite, you must define the DIEONDBERROR constant for database errors to display | |
define( 'DIEONDBERROR', true ); | |
/** Error reporting */ | |
$table = $wpdb->prefix . "report_performance"; | |
$charset_collate = $wpdb->get_charset_collate(); | |
$createTable = "CREAT TABLE IF NOT EXISTS $table ( |