Skip to content

Instantly share code, notes, and snippets.

View MichaelConte's full-sized avatar

Michael Conte MichaelConte

View GitHub Profile
@MichaelConte
MichaelConte / function.php
Created July 29, 2019 12:05
Permit User to Upload Images
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');
}
@MichaelConte
MichaelConte / Hide Private Content From Non Users With PHP Code Snippet
Created March 5, 2019 05:44
Hide private content from non users with PHP Code snippet, You can restrict non members to see any of your private content.
[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;
<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>
@MichaelConte
MichaelConte / style.css
Created June 4, 2015 05:49
Animated Tooltip with CSS3
.tooltip-container {
/* Forces tooltip to be relative to the element, not the page */
position:relative;
cursor:help;
}
.tooltip {
display:block;
position:absolute;
width:150px;
@MichaelConte
MichaelConte / functions.php
Created June 3, 2015 18:00
How to Show or Hide Widgets on Specific Pages without Plugin
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;
}
}
}
@MichaelConte
MichaelConte / Shortcode.php
Last active August 29, 2015 14:22
Create Short Code for Custom Post Type with WordPress Custom Plugin
<?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() {