tidak mengerti mengenai pengeditan code – code
-
bagi master” atau suhu”..
mohon bantuannya..<?php
/*
Plugin Name: Add Posts to Pages
Plugin URI: http://*******/wordpress-plugins/add-posts-pages/
Description: Easily add posts to pages with this super lightweight plugin. Just select the number of posts to show & the category to pull them from and voila, you’ve added a set of posts anywhere on any page.
Version: 1.2.3
Author: wyvers
Author URI: **********
License: GPL2
*//*
** Function: add_posts_func
** Purpose: shortcode to allow easy addition of filtered posts to pages in WordPress
** Inputs:
** show – number of posts to show
** category – the slug of the category to be shown
** tag – the slug of the tag to be shown
** Output: an unordered list of posts matching the input filter parameters using query_posts() WordPress function
*/
function add_posts_func( $atts ) {//extracting input parameters (attributes of shortcode)
extract( shortcode_atts( array(
‘show’ => 5,
‘category’ => ”,
‘tag’ => ”,
‘full’ => false,
‘h’ => ‘2’,
‘img’ => false,
‘size’ => 64
), $atts ) );/***************************************************Config*********************************************************/
$h = ‘h’.$h;
//querying posts on input filter parameters
query_posts(‘category_name=’.$category.’&posts_per_page=’.$show.’&tag=’.$tag);/***************************************************Out***********************************************************/
//setting the output variable to an unordered list
global $out;
$out = ”;//if NOT full & No images output, start a unordered list
if(!$full && !$img)
$out = ‘- ‘;
- ‘;} else {$out .= ‘<‘.$h.’ class=”title”>’;}
$out .= ‘‘ . $title . ‘‘;
if(!$img){$out .= ‘
//START famous WordPress loop
if(have_posts()) : while(have_posts()) : the_post();//Setting permalinm & title for ease of use later
$permalink = get_permalink();
$title = get_the_title();if($img){
$out .= ‘‘
.get_the_post_thumbnail(get_the_id(), array($size,$size))
.’‘;}
if($full){
$content = get_the_content();
$content = apply_filters(‘the_content’, $content);
$content = str_replace(‘]]>’, ‘]]>’, $content);//output full post
$out .= ‘<div class=”add_posts” style=”clear:both;”>’;
$out .= ‘<‘.$h.’ class=”title”>‘ . $title . ‘</’.$h.’>’;
$out .= ‘<div class=”post-content” style=”clear:both”;>’.$content.'</div>’;
$out .= ‘<hr style=”margin:10px 0″>’;
$out .= ‘</div>’;
} else {
//output list items
if(!$img){$out .= ‘‘;} else {$out .= ‘</’.$h.’>’;}
}//END famous WordPress loop
endwhile; endif;//reset query so rest of page can load.
wp_reset_query();//if NOT full output, close the unordered list
if(!$full && !$img)
$out .= ‘‘;
//returning the output to page
return $out;
}//instantiate the shortcode
add_shortcode( ‘add_posts’, ‘add_posts_func’ );apakah ada yang bisa membantu saya mengenai ini..
apa yang harus saya edit agar bisa tampil di bagian halaman saya.. - ‘;} else {$out .= ‘<‘.$h.’ class=”title”>’;}
- Topik ‘tidak mengerti mengenai pengeditan code – code’ tertutup untuk balasan baru.