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 | |
/* | |
Plugin Name: tinyLogin | |
Plugin URI: http://wp.tribuna.lt/tiny-login | |
Description: A simple front-end login/registration system. Adds template tags and shortcodes. Shortcodes: [tiny_form_login]/[tiny_form_register]. Template tags: get_tiny_form_login()/get_tiny_form_register() and the_tiny_form_login()/the_tiny_form_register() | |
Version: 0.1 | |
Author: Arūnas | |
Author URI: http://wp.tribuna.lt/ | |
Text Domain: tiny_login | |
*/ |
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
# Copyright (c) 1994 Microsoft Corp. | |
# | |
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows 95 | |
# | |
# This file contains the mappings of IP addresses to host names. Each | |
# entry should be kept on an individual line. The IP address should | |
# be placed in the first column followed by the corresponding host name. | |
# The IP address and the host name should be separated by at least one | |
# space. | |
# |
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 | |
/* Register styles and scripts */ | |
function post_section_voting_scripts() { | |
wp_register_style('post_section_voting_style', plugins_url('style.css',__FILE__ )); | |
wp_enqueue_style('post_section_voting_style'); | |
wp_register_script( 'post_section_voting_script', plugins_url('voting_script.js',__FILE__ ),array('jquery')); | |
wp_enqueue_script('post_section_voting_script'); | |
wp_localize_script( 'post_section_voting_script', 'PsvAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php'))); | |
} |
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_filter( 'pre_get_posts', 'skaitykit_oldie'); | |
function skaitykit_oldie($query) { | |
if (! is_admin() && $query->is_main_query()) { | |
if (!current_user_can('read_premium')) | |
$query->set('date_query',array(array('before'=>'-24 hour'))); | |
} | |
return $query; | |
} |
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 | |
if (!is_user_logged_in()) { | |
wp_redirect(wp_login_url()); | |
exit; | |
} |
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 | |
$images =& get_children( array ( | |
'post_parent' => $post->ID, | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image' | |
)); | |
if ( empty($images) ) { | |
// no attachments here | |
} else { |
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_action( 'admin_head-nav-menus.php', 'inject_cpt_archives_menu_meta_box'); | |
function inject_cpt_archives_menu_meta_box( $object ) { | |
add_meta_box( 'add-cpt', __( 'CPT Archives' ), 'wp_nav_menu_cpt_archives_meta_box', 'nav-menus', 'side', 'default' ); | |
return $object; /* pass */ | |
} | |
/* render custom post type archives meta box */ | |
function wp_nav_menu_cpt_archives_meta_box() { |
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
var c = []; | |
jQuery('.colors span').each(function(){ | |
c[c.length] = jQuery(this).attr('title'); | |
}); | |
console.log(c); |
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
add_filter('the_title','arunas_switch_title'); | |
function arunas_switch_title($title) { | |
if (!is_admin() && $title == '[Dynamic title]') { | |
if (is_user_logged_in()) { | |
$title = __('My Account','themename'); | |
} else { | |
$title = __('Login','themename'); | |
} | |
} | |
return $title; |
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
if (is_user_logged_in()) { | |
wp_nav_menu( array( 'theme_location' => 'primary-loggedin' ) ); | |
} else { | |
wp_nav_menu( array( 'theme_location' => 'primary' ) ); | |
} |