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 ( current_user_can('contributor') && !current_user_can('upload_files') ) | |
add_action('admin_init', 'allow_contributor_uploads'); | |
function allow_contributor_uploads() { | |
$contributor = get_role('contributor'); | |
$contributor->add_cap('upload_files'); | |
} |
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] | |
function member( $atts, $content = null ) { | |
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) { | |
return $content; | |
return ”; | |
} else { | |
$yonlendir = get_permalink(); | |
$form = wp_login_form(array(‘echo’ => false, ‘redirect’ => $yonlendir )); | |
return $form; |
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 | |
function autoset_featured() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); | |
if (!$already_has_thumb) { | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID, $attachment_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
function set_featured_image_for_posts() { | |
// Get all posts so set higher number, | |
// you can increase to any number if you have big amount of posts | |
$args = array( 'numberposts' => 5000); | |
// all posts | |
$all_posts = get_posts( $args ); | |
foreach($all_posts as $k=>$v) | |
{ |
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
<i class="tooltip-container"><b>Lorem ipsum dolor sit amet</b><span class="tooltip">Hello! This is a first tooltip!</span></i> | |
<em class="tooltip-container"><b>Pellentesque id auctor sem</b><span class="tooltip tooltip-style1">This is a second tooltip!</span></em> |
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
.tooltip-container { | |
/* Forces tooltip to be relative to the element, not the page */ | |
position:relative; | |
cursor:help; | |
} | |
.tooltip { | |
display:block; | |
position:absolute; | |
width:150px; |
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_display_callback', 'hide_widget_pages', 10, 3 ); | |
function hide_widget_pages( $instance, $widget, $args ) { | |
if ( $widget->id_base == 'pages' ) { // change 'pages' to widget name | |
if ( !is_page( 'contact' ) ) { // change page name | |
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 | |
/* | |
Plugin Name: My Shortcode Plugin | |
Description: display custom post type using short code. | |
Version: 1.0 | |
Author: Author Name | |
*/ | |
// register custom post type to work with | |
add_action('init', 'webr_faq_post_type'); | |
function webr_faq_post_type() { |