WordPress

User for something Crazy Opiton

http://localhost:81/wordpress/wp-admin/options.php

Best Plugin for Slider

Meta Slider

http://www.metaslider.com/

// Display Parent/child of (Post and Pages)

<?php
$args = array(
‘post_type’       => ‘page’,
‘parent’          => ‘0’,
‘post_status’     => ‘publish’ );
$parent_pages=get_pages( $args );
?>
<?php
foreach ($parent_pages as $parent_page) {
$url = wp_get_attachment_url( get_post_thumbnail_id($parent_page->ID) );
echo get_the_title($parent_page->ID).'</br>’;

$args = array(
‘post_type’       => ‘page’,
‘child_of’          => $parent_page->ID,
‘post_status’     => ‘publish’ );
$child_pages=get_pages( $args );

foreach ($child_pages as $child_page) {
$url = wp_get_attachment_url( get_post_thumbnail_id($child_page->ID) );

echo ‘–‘.get_the_title($child_page->ID).'</br>’;
}
} ?>

//Theme for tutorial

http://www.justfreetemplates.com/wordpress-themes/view/1952.html

// Remove Comment Section in Page & Post.

If you are comfortable editing theme files, go into page.php, index.php, loop.php or in whatever other files your particular theme uses the comment function, and remove or comment out the function. It may look something like this:

<?php comments_template(); ?>

To comment it out (make it not have any effect on your site) put two slashes in front of it, like this:

<?php // comments_template(); ?>

Just do not edit Twenty Ten directly or all your changes will be overwritten the next time you update WordPress.

// Display Theme Path URL

<link rel=”pingback” href=”<?php echo get_template_directory_uri(); ?>/css/style.css” />

<script type=”text/javascript” src=”<?php echo get_template_directory_uri(); ?>/js/jquery.js”></script>

<img alt=”” src=”<?php echo get_template_directory_uri(); ?>/images/telephone-number.png” />

//Display Contact 7 Form direct in Your Page

<?php echo do_shortcode(‘[contact-form-7 id=”22″ title=”Contact”]’); ?>

// Display Meta-tag & Featured Image

<div class=”slider_area”>
<?php
$args = array(
‘post_type’ => ‘slider’,
‘post_status’ => ‘publish’ );
$slider_posts=get_posts( $args );
?>
<ul id=”slider”>
<?php
foreach ($slider_posts as $slider_post) {
$meta_values = get_post_meta($slider_post->ID, ‘Link’, $single);
$metas = explode(‘\n’, $meta_values[0]);
$url = wp_get_attachment_url( get_post_thumbnail_id($slider_post->ID) );
?>
<li>
<div class=”left_sidebar”>
<ul>
<?php
foreach($metas as $meta)
{
echo ‘<li>’.$meta.'</li>’;
}
?>
</ul>
</div>

<div class=”slider_img flt_right”><?php echo ‘<a href=’.$meta_values[0].’><img src=”‘.$url.'” width=”650″ alt=”‘.$post_data->post_title.'”></a>’; ?></div>
</li>
<?php } ?>
</ul>
</div>

//Custom Post

function home_post_init() {
$labels = array(
‘name’ => _x(‘Home Post’, ‘post type general name’),
‘singular_name’ => _x(‘Home Post’, ‘post type singular name’),
‘add_new’ => _x(‘Add New’, ‘home_post’),
‘add_new_item’ => __(‘Add New Home Post’),
‘edit_item’ => __(‘Edit Home Post’),
‘new_item’ => __(‘New Home Post’),
‘all_items’ => __(‘All Home Post’),
‘view_item’ => __(‘View Home Post’),
‘search_items’ => __(‘Search Home Post’),
‘not_found’ => __(‘No Home Post found’),
‘not_found_in_trash’ => __(‘No Home Post found in Trash’),
‘parent_item_colon’ => ”,
‘menu_name’ => ‘Home Post’
);
$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘query_var’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => false,
‘menu_position’ => null,
‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘custom-fields’)
);
register_post_type(‘home_post’,$args);
}
add_action( ‘init’, ‘home_post_init’ );

// Display Page Or Post Content.

<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>

// Custome Reports Start For Single Value
add_action(‘admin_menu’, ‘estate_custom_menu’);
function estate_custom_menu() {
add_menu_page(“Home News Box”, “Home Box”, ‘administrator’, ‘estate_news_box’, ‘estate_news_box_form’,”);
}
function estate_news_box_form() {

if($_POST[“btn_submit”] && $_POST[“btn_submit”] == “Save”) {

update_option(‘v_news_title’,$_POST[“v_news_title”]);
update_option(‘v_news_url’,$_POST[“v_news_url”]);
update_option(‘v_fb_url’,$_POST[“v_fb_url”]);
update_option(‘v_twitter_url’,$_POST[“v_twitter_url”]);

}

?>
<form name=”frmnewsbox” id=”frmnewsbox” action=”” method=”post”>
<table width=”95%” cellspacing=”1″ cellpadding=”1″>
<tr>
<td colspan=”2″ align=”left” height=”40″ valign=”middle”></td>
</tr>
</table>
<table width=”95%” cellspacing=”1″ cellpadding=”1″ border=”0″>
<tr>
<td colspan=”2″ align=”left” valign=”middle” style=”background:#666; color:#FFF; padding:0px 10px;”><h2>Home Page News Box</h2></td>
</tr>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>
<tr>
<td width=”20%” align=”left” valign=”middle” style=”padding:5px 10px;”>News Title</td>
<td align=”left” valign=”middle” style=”padding:5px 10px;”><input type=”text” name=”v_news_title” id=”v_news_title” value=”<?php echo get_option( ‘v_news_title’ );?>” size=”50″ /></td>
</tr>

<tr>
<td align=”left” valign=”middle” style=”padding:5px 10px;”>Read More URL</td>
<td align=”left” valign=”middle” style=”padding:5px 10px;”><input type=”text” name=”v_news_url” id=”v_news_url” value=”<?php echo get_option( ‘v_news_url’ );?>” size=”50″ /></td>
</tr>

<tr>
<td width=”20%” align=”left” valign=”middle” style=”padding:5px 10px;”>Facebook URL</td>
<td align=”left” valign=”middle” style=”padding:5px 10px;”><input type=”text” name=”v_fb_url” id=”v_fb_url” value=”<?php echo get_option( ‘v_fb_url’ );?>” size=”50″ /></td>
</tr>

<tr>
<td align=”left” valign=”middle” style=”padding:5px 10px;”>Twitter URL</td>
<td align=”left” valign=”middle” style=”padding:5px 10px;”><input type=”text” name=”v_twitter_url” id=”v_twitter_url” value=”<?php echo get_option( ‘v_twitter_url’ );?>” size=”50″ /></td>
</tr>

<tr>
<td>&nbsp;</td>
<td align=”left” valign=”middle” style=”padding:5px 10px;”><input type=”submit” name=”btn_submit” id=”btn_submit” value=”Save” /></td>
</tr>

</table>
</form>
<?php
}
?>

Add Atribute Custome Fields Display

<?php
$args = array(
‘orderby’         => ‘post_date’,
‘order’           => ‘DESC’,
‘post_type’       => ‘slider’,
‘post_status’     => ‘publish’ );
$slider_posts=get_posts(  $args );

foreach ($slider_posts as $slider_post) {
$meta_values = get_post_meta($slider_post->ID, ‘Link’, $single);
$metas = explode(“\n”, $meta_values[0]);
foreach($metas as $meta)
{
echo ‘<li>’.$meta.'</li>’;
}
}
die();
?>

Cutome Post

// Help  URL : http://codex.wordpress.org/Function_Reference/register_post_type
// Put This Code into function.php
add_action( ‘init’, ‘slider_custom_init’ );
function slider_custom_init() {
$labels = array(
‘name’ => _x(‘Slider’, ‘post type general name’),
‘singular_name’ => _x(‘Slider’, ‘post type singular name’),
‘add_new’ => _x(‘Add New Slider’, ‘student’),
‘add_new_item’ => __(‘Add New Slider’),
‘edit_item’ => __(‘Edit Slider’),
‘new_item’ => __(‘New Slider’),
‘all_items’ => __(‘All Slider’),
‘view_item’ => __(‘View Slider’),
‘search_items’ => __(‘Search Slider’),
‘not_found’ =>  __(‘No Slider found’),
‘not_found_in_trash’ => __(‘No  Slider found in Trash’),
‘parent_item_colon’ => ”,
‘menu_name’ => ‘Slider’

);

$args = array(
‘labels’ => $labels,
‘public’ => true,
‘publicly_queryable’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘query_var’ => true,
‘rewrite’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => true,
‘hierarchical’ => true,
‘menu_position’ => null,
‘supports’ => array( ‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’, ‘comments’,’page-attributes’,’custom-fields’ )
);

register_post_type(‘slider’,$args);
}

Child Post

foreach ($services_posts as $service_data) {

$args = array(
‘sort_column’     => ‘menu_order’,
‘numberposts’     => 100,
‘orderby’         => ‘post_date’,
‘order’           => ‘DESC’,
‘post_type’       => ‘services’,
‘parent’          => $service_data->ID,
‘hierarchical’      => true,
‘child_of’          => $service_data->ID,
‘post_status’     => ‘publish’ );
$child_posts=get_pages( $args );

$permalink = get_permalink($service_data->ID);
echo ‘<li><a href=’;

if(!empty($child_posts))
echo get_permalink($child_posts[0]->ID);
else
echo get_permalink($service_data->ID);

echo ‘>’.$service_data->post_title.”</a>”;

if(!empty($child_posts)) {
echo ‘<ul>’;
foreach ($child_posts as $child_post) {
$permalink = get_permalink($child_post->ID);
echo ‘<li style=”width: 230px;”><a href=’.get_permalink($child_post->ID).’>’.$child_post->post_title.”</a></li>”;
}
echo ‘</ul>’;
}
echo ‘</li>’;
}

Parent Post

Get Parent Page ID in WordPress – $post->post_parent
http://wordpress.org/extend/plugins/multiple-post-thumbnails/
http://wordpress.org/extend/plugins/custom-post-template/installation/

Right Click  Selection Color

//Put This Code Into Style sheet
::-moz-selection { color: gold;  background: red; }
::selection      { color: gold;  background: red; }

FaceBook Like Box

// Put this code below body tag.
<div id=”fb-root”></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = “//connect.facebook.net/en_US/all.js#xfbml=1&appId=424722887568340″;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>

//Recive Your Page Code from FB
//URL http://developers.facebook.com/docs/reference/plugins/like-box/
// and any where u want.
<div data-href=”http://www.facebook.com/TheTrainersEdge.JasonDepaoli&#8221; data-width=”292″ data-colorscheme=”dark” data-show-faces=”true” data-stream=”true” data-header=”true”></div>

//Display Custome Page with LIMIT & Links

<?php

$args = array(
‘numberposts’ => 3,
‘orderby’ => ‘post_date’,
‘order’ => ‘DESC’,
‘post_type’ => ‘home_post’,
‘post_status’ => ‘publish’ );
$home_posts=get_posts( $args );
//print_r($home_posts); ?>

<?php
$col = 1;
foreach ($home_posts as $post_data) { //echo “<pre>”;print_r($post_data);
if($col == 1){$color=’#5D1513′;}else if($col == 2){ $color=’#461D1C’;}else if($col == 3){ $color=’#3C0806′;}
$meta_values = get_post_meta($post_data->ID, ‘Link’, $single);
$url = wp_get_attachment_url( get_post_thumbnail_id($post_data->ID) );
?>
<div class=”single_column”>
<?php
echo ‘<a href=’.$meta_values[0].’><img src=”‘.$url.'” width=”310″ height=”113″ alt=”‘.$post_data->post_title.'”></a>’; ?>
<div class=”single_column_inner” style=”background-color:<? echo $color; ?>;margin-top: -6px;”>
<?php echo ‘<h3>’.$post_data->post_title.'</h3>’;?>
<?php echo $post_data->post_content; ?>
</div>
</div>
<? $col++; } ?>

// Display Menus in Header or Footer

<div class=”footer_menu”>
&nbsp;&nbsp;Copyright 2012<br />
<?php
// Set the Get Only Parent
$args = ”;
$items = wp_get_nav_menu_items( ‘Bottom Menu’, $args );
$num_menu = 1;
foreach($items as $row) {
if($row->menu_item_parent == 0){
?> <a href=”<?php echo $row->url;?>”> <?php echo $row->title;?></a>

<?php $size = sizeof($items);
if($num_menu < ($size))
{
echo ‘|’;
}
$num_menu++; }
}
?>
</div>
===================== Start Create Plugin =============================================
<?php
/*
Plugin Name: RC Faq
Plugin URL: http://remicorson.com/rc-faq
Description: A simple FAQ plugin
Version: 1.0
Author: Remi Corson
Author URI: http://remicorson.com
Contributors: corsonr
*/

/*
* Register CPT rc_faq
*
*/
function rc_faq_setup_post_types() {

$faq_labels = apply_filters( ‘rc_faq_labels’, array(
‘name’ => ‘FAQs’,
‘singular_name’ => ‘FAQ’,
‘add_new’ => __(‘Add New’, ‘rc_faq’),
‘add_new_item’ => __(‘Add New FAQ’, ‘rc_faq’),
‘edit_item’ => __(‘Edit FAQ’, ‘rc_faq’),
‘new_item’ => __(‘New FAQ’, ‘rc_faq’),
‘all_items’ => __(‘All FAQs’, ‘rc_faq’),
‘view_item’ => __(‘View FAQ’, ‘rc_faq’),
‘search_items’ => __(‘Search FAQs’, ‘rc_faq’),
‘not_found’ => __(‘No FAQs found’, ‘rc_faq’),
‘not_found_in_trash’ => __(‘No FAQs found in Trash’, ‘rc_faq’),
‘parent_item_colon’ => ”,
‘menu_name’ => __(‘FAQs’, ‘rc_faq’),
‘exclude_from_search’ => true
) );
$faq_args = array(
‘labels’ => $faq_labels,
‘public’ => true,
‘publicly_queryable’=> true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘query_var’ => true,
‘capability_type’ => ‘post’,
‘has_archive’ => false,
‘hierarchical’ => false,
‘supports’ => apply_filters(‘rc_faq_supports’, array( ‘title’, ‘editor’ ) ),
);
register_post_type( ‘rc_faq’, apply_filters( ‘rc_faq_post_type_args’, $faq_args ) );

}

add_action(‘init’, ‘rc_faq_setup_post_types’);
/*
* Add [rc_faq limit=”-1″] shortcode
*
*/
function rc_faq_shortcode( $atts, $content = null ) {

extract(shortcode_atts(array(
“limit” => ”
), $atts));

// Define limit
if( $limit ) {
$posts_per_page = $limit;
} else {
$posts_per_page = ‘-1’;
}

ob_start();

// Create the Query
$post_type = ‘rc_faq’;
$orderby = ‘menu_order’;
$order = ‘ASC’;

$query = new WP_Query( array (
‘post_type’ => $post_type,
‘posts_per_page’ => $posts_per_page,
‘orderby’ => $orderby,
‘order’ => $order,
‘no_found_rows’ => 1
)
);

//Get post type count
$post_count = $query->post_count;
$i = 1;

// Displays FAQ info
if( $post_count > 0) :

// Loop
while ($query->have_posts()) : $query->the_post();
?>

<h3 class=”rc_faq_title”><a href=”#” onclick=”rc_faq_toggle(‘rc_faq_<?php echo get_the_ID(); ?>’);”><?php the_title(); ?></a></h3>
<p id=”rc_faq_<?php echo get_the_ID(); ?>” style=”display: none;”><?php echo get_the_content(); ?></p>

<?php
$i++;
endwhile;

endif;

// Reset query to prevent conflicts
wp_reset_query();

?>
<script type=”text/javascript”>
<!–
function rc_faq_toggle(id) {
var e = document.getElementById(id);
e.style.display = ((e.style.display!=’none’) ? ‘none’ : ‘block’);
}
//–>
</script>
<?php

return ob_get_clean();

}

add_shortcode(“rc_faq”, “rc_faq_shortcode”);

https://bharat864.files.wordpress.com/2012/07/faq-plugin.docx

====================== End Create Plugin =============================================

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: