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: Remote Images Grabber updated for G&P | |
Plugin URI: http://andrey.eto-ya.com/wordpress/my-plugins/remote-images-grabber | |
Description: Fetches images from an URL or a piece of html-code, saves them directly into your blog media directory, and attaches to the appointed post. Updated with added automated adding of a media file to a custom taxonomy after upload. For Grapes&Corks website | |
Author: Andrey K. | |
Author URI: http://andrey.eto-ya.com/ | |
Version: 0.6.1 | |
Requires at least: 2.8.6 | |
Tested up to: 3.4.1 |
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 widgets_init_now() { | |
register_sidebar( array( | |
'name' => 'В шапке', | |
'id' => 'header' | |
) ); | |
register_sidebar( array( | |
'name' => 'Левая колонка', | |
'id' => 'aside_left' | |
) ); |
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('show_admin_bar', '__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
//Custom content function with words manual limit | |
function content($limit, $postid, $showmorelink = true) { //Normally, the second parameter provided is '$post->ID' | |
$content = explode(' ', get_post_field('post_content', $postid), $limit); | |
if (count($content)>=$limit) { | |
array_pop($content); | |
$content = implode(" ",$content); | |
$content = preg_replace('/\[.+\]/','', $content); | |
$content = apply_filters('the_content', $content); | |
$content = str_replace(']]>', ']]>', $content); | |
$content = strip_tags($content,'<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 excerpts to pages | |
add_action( 'init', 'add_excerpts_to_pages' ); | |
function add_excerpts_to_pages() { | |
add_post_type_support( 'page', 'excerpt' ); | |
} |
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
//the_category expanded to support custom taxonomies, with possibility to exclude certain categories/terms | |
function catOut($category,$tax,$showlink) { | |
$text = ''; | |
$text .= '<li>'; | |
if ($showlink) {$text .= '<a href="' . get_term_link($category->term_id,$tax).'" title="'.$category->name.'"'.'>';} | |
$text .= $category->name; | |
if ($showlink) {$text .= '</a>';} | |
$text .= '</li>'; | |
return $text; | |
} |
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 | |
$args = array( | |
'numberposts' => -1, // Using -1 loads all posts | |
'orderby' => 'menu_order', // This ensures images are in the order set in the page media manager | |
'order'=> 'ASC', | |
'post_mime_type' => 'image', // Make sure it doesn't pull other resources, like videos | |
'post_parent' => $post->ID, // Important part - ensures the associated images are loaded | |
'post_status' => null, | |
'post_type' => 'attachment' | |
); |
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 cleaner_gallery($output, $attr) { | |
$base_class = 'c-content-gallery'; | |
if ( is_feed() ) { | |
return $output; | |
} | |
if ( isset( $attr['orderby'] ) ) { | |
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); | |
if ( !$attr['orderby'] ) { | |
unset( $attr['orderby'] ); |
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 custom post type (books) | |
function book_custompost_init() { | |
$labels_books = array( | |
'name' => _x('Публикации', 'post type general name'), | |
'singular_name' => _x('Публикация', 'post type singular name'), | |
'add_new' => _x('Добавить', 'book'), | |
'add_new_item' => __('Добавить '), | |
'edit_item' => __('Редактировать публикацию'), | |
'new_item' => __('Новая публикация'), | |
'all_items' => __('Все публикации'), |
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
//Create categories for books | |
function create_booktag_taxonomy() { | |
$labels_booktag = array( | |
'name' => _x( 'Тэги публикаций', 'taxonomy general name' ), | |
'singular_name' => _x( 'Тэг публикаций', 'taxonomy singular name' ), | |
'search_items' => __( 'Искать тэги публикаций' ), | |
'all_items' => __( 'Все тэги публикаций' ), | |
'edit_item' => __( 'Редактировать' ), | |
'update_item' => __( 'Обновить' ), | |
'add_new_item' => __( 'Добавить тэг публикаций' ), |
OlderNewer