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 | |
// Use this if you need the Relevanssi advanced search plugin to index content in custom fields. | |
add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3); | |
function excerpt_function($content, $post, $query) { | |
global $wpdb; | |
$fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta"); | |
foreach($fields as $key => $field){ | |
$field_value = get_post_meta($post->ID, $field, TRUE); | |
$content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value ); |
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 this to functions.php | |
function hc_show_content($path) { | |
$post = get_page_by_path($path); | |
$content = apply_filters('the_content', $post->post_content); | |
echo $content; | |
} | |
?> |
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 | |
// Sample Theme Customizer Options for WordPress | |
// This example allows you to upload your logo, add your contact info, and add your social media links. | |
// Reference: https://codex.wordpress.org/Theme_Customization_API | |
// See also: http://themefoundation.com/wordpress-theme-customizer/ | |
// Add the following to functions.php (or put it in a separate file - e.g. theme-customizer.php - and call it from functions.php) | |
new theme_customizer(); | |
class theme_customizer |
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 | |
// Assign custom permissions for specific user roles | |
// This example gives Editors access to Menus and Theme Options: | |
add_action( 'admin_menu', 'edit_admin_menus' ); | |
// Allow editors to manage theme options (under Appearance) | |
$role_object = get_role( 'editor' ); | |
$role_object->add_cap( 'edit_theme_options' ); |
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 Custom Dashboard Widgets | |
// This example adds a 'welcome' message to the dashboard. | |
' | |
add_action('wp_dashboard_setup', 'sw_custom_dashboard_widgets'); | |
function sw_custom_dashboard_widgets() { | |
global $wp_meta_boxes; | |
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; | |
$sw_widget_backup = array( 'sw_custom_dashboard_widgets' => $normal_dashboard['sw_custom_dashboard_widgets'] ); | |
unset( $normal_dashboard['sw_custom_dashboard_widgets'] ); |
NewerOlder