Admin panel is under presentation tab. Author: Aaron Dowden Version: 2.1a Author URI: http://anthologyoi.com/ */ // new ajax('$home/wp-content/plugins/inap/get_info.php', {postBody: 'id='+id+'&type='+type, update: $('post_'+type+'_'+id), onComplete: show_it(id,type)}); '', ,new ajax('$home/wp-content/plugins/inap/get_info.php', {postBody: 'type='+type+string+'&comment='+document.getElementById('comment').value+'&comment_post_ID='+id, update: $('submit_form_'+id), onComplete: nap(id, 550)}); add_action('wp_head', 'inap_header'); $use_options = get_option('inap_use_options'); $inapall = array(); if($use_options || strpos($_SERVER['PHP_SELF'], 'wp-admin')){ $inapall = get_option('inap'); } function inap_header(){ global $inapall;global $wp_version; $home = get_settings('siteurl'); if($wp_version == 2.1){ if($inapall['use_prototype'] == 1 || $inapall['use_scriptaculous'] == 1){$ajax = 'prototype';}else{$ajax='sack';} if($inapall['use_scriptaculous'] == 1){wp_print_scripts('scriptaculous-effects');} wp_register_script('inap-misc', '/wp-content/plugins/inap/inap-misc.js.php', false, '1'); wp_print_scripts(array($ajax, 'inap-misc')); }else{ if($inapall['use_prototype'] == 1 && $inapall['use_scriptaculous'] != 1){ $ajax = $inapall['prototype_library_url']; }elseif($inapall['use_scriptaculous'] == 1){ echo ''."\n"; echo ''."\n"; echo ''."\n"; }else{ $ajax = '/wp-includes/js/tw-sack.js'; } echo ''."\n"; if($ajax){ echo ''."\n"; } } } function inap_content($link_show_text = 'Continue Reading', $link_hide_text='Hide Post', $stripteaser = 0){ return inap_post($link_show_text, $link_hide_text,1,1,'content'); } function inap_excerpt($link_show_text = 'Continue Reading', $link_hide_text='Hide Post'){ return inap_post($link_show_text, $link_hide_text,3,0,'excerpt',55); } function inap_post_s($args=''){ $args= str_replace('’','\'',$args); $args= str_replace('“','"',$args); $args= str_replace('”','"',$args); parse_str($args,$r); if ($r['link_show_text'] == ''){ $r['link_show_text'] = 'Click to continue reading'; } if ($r['link_hide_text'] == ''){ $r['link_hide_text'] = 'Hide Post'; } if ($r['split_mode'] == ''){ $r['split_mode'] = '0'; } if ($r['show_html'] == ''){ $r['show_html']= '1'; } if ($r['default_behavior'] == ''){ $r['default_behavior'] = 'content'; } if ($r['word_limit'] == ''){ $r['word_limit'] = '121'; } if ($r['line_break'] == ''){ $r['line_break'] = '1'; } if ($r['background_color'] == ''){ $r['background_color'] = '#FFF'; } $r['link_show_text'] = stripslashes(htmlspecialchars($r['link_show_text'], ENT_QUOTES)); $r['link_hide_text'] = stripslashes(htmlspecialchars( $r['link_hide_text'], ENT_QUOTES)); return inap_post($r['link_show_text'], $r['link_hide_text'], $r['split_mode'], $r['show_html'], $r['default_behavior'],$r['word_limit'], $r['line_break'],$r['background_color']); } function inap_get_text($link_text){ // This nasty function is to allow you to use the_title etc inside the admin panel. global $id, $post; $link_text = stripslashes($link_text); preg_match_all('/([a-zA-Z]*_.*?\(.*?\))/',$link_text,$matches); foreach($matches[0] as $match){ $string[] = $match; eval('$replacement[] = '.$match.';'); } $link_text = str_replace($string, $replacement,$link_text ); //We do this otherwise it will double encode things. $link_text= str_replace('’','\'',$link_text); $link_text= str_replace('“','“',$link_text); $link_text= str_replace('”','”',$link_text); return htmlspecialchars($link_text,ENT_QUOTES); } add_action('inap_post','inap_post'); function inap_post($link_show_text='Click to continue reading', $link_hide_text='Hide Post', $split_mode=2, $show_html=1, $default_behavior='content', $word_limit=121, $line_break = 1, $background_color = '#FFF'){ global $use_options,$inapall; global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages; global $preview; global $pagenow; if(!$link_show_text){ $link_show_text='Click to continue reading'; } if($use_options == true){ while (list($key, $value) = each ($inapall)){ if(!empty($value)){ $$key = $value; } } reset($inapall); $link_show_text = inap_get_text($link_show_text); $link_hide_text = inap_get_text($link_hide_text); } if ( !empty($post->post_password) ) { // if there's a password if ( stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie $output = get_the_password_form(); } } // decide on the content if ($post->post_excerpt != ''){ $output = $post->post_excerpt; }else{ $content = $pages[$page-1]; if($show_html == 0){ $content = strip_tags($content); } if($split_mode == 1){ $content = explode('', $content, 2); $output = $content[0]; }elseif($split_mode == 2){ if(strpos($content,'') !== false){ $content = explode('', $content, 2); $output = $content[0]; }else{ $content = force_balance_tags($content); $content = explode(chr(13), $content, $line_break+1); for($x=0; $x < $line_break; $x++){ $output .= $content[$x]; } $output = force_balance_tags($output); } }else{ $words = explode(' ', $content, $word_limit + 1); if (count($words) > $word_limit) { array_pop($words); array_push($words, '...'); $output = implode(' ', $words); $show_more=1; }else{ $content = force_balance_tags($content); $output=$content; } } } //lets make it look good if ( $preview ){ // preview fix for javascript bug with foreign languages $output =preg_replace('/\%u([0-9A-F]{4,4})/e', "''.base_convert('\\1',16,10).';'", $output); } if ($default_behavior == 'content'){ $output = apply_filters('the_content', $output.chr(13)); }else{ $output = apply_filters('the_excerpt', $output); } $output = str_replace(']]>', ']]>', $output); if($inapall['use_fade'] == 1){ //this is for IE support only. Everybody BOOOOOOO IE //It's not like they could make it easy for us... $style = "zoom:1; background-color:$background_color;"; } // Start the output. echo '
Updated
'.$message;
echo '
Now open your index.php (or post.php depending on your theme) in your themes folder. To display posts inline replace the_content or the_excerpt with inap_content or inap_excerpt respectively. These will give you the most basic options and are mirror images of the normal function.
To display comments in-line add <?php do_action('inap_comments'); ?> where you want the comments to appear when they are loaded and add <?php do_action('inap_comments_link'); ?> where you want the show/hide comments link to appear.
To display the add comment box in-line add <?php do_action('inap_addcomments'); ?> where you want the add comment box to appear and add <?php do_action('inap_addcomments_link'); ?> where you want the show/hide add comment box link to appear.
Save the file and upload it to your current theme folder.
This plugin adds the following tags for the loop (there are multiple ways to do the same thing):
Listed in preferential order.
To show post content:
do_action('inap_post'); <- best if you use the admin panel.
inap_post_s(); <- Accepts string style functions
inap_excerpt();<- Exact duplicate of the_excerpt
inap_content();<- Exact duplicate of the_content
inap_post(); <- Because of the user un-friendliness one of the above is prefered to this one.
To show comment link:
do_action('inap_comments_link');
inap_comments_link();
To show comment content:
do_action('inap_comments');
inap_comments();
To show add comment link:
do_action('inap_addcomments_link');
inap_addcomments_link();
To show add comment box:
do_action('inap_addcomments');
inap_addcomments();
Split Mode:Inap can display the content itself in three ways. Option 1 just splits the post only if there is a <!–more–> tag. Option 2 always splits it after the line break you set (defaults to the first). Option 3 emulates the_excerpt in that it will trim it to a specified number of words. However, if you explicitly add an excerpt to the post it will automatically use that in all cases.
Show HTML:The default is to show the html (1), but if you want html stripped from your previews you can set this to off (0). Srippping HTML may cause some plugins not to work correctly, and may cause display errors.
Should other information be here? Drop me a comment.