0
Posted on 1:15 PM by Softminer and filed under

Replace following line:

<?php  the_content('More >>'); ?>

with,

<?php
  $content = apply_filters('the_content', $post->post_content);  //get the post content store in $content
  $save = explode("</p>", $content);  //Separate the content into <p> blocks
  $tcount=0; //this is count for number of <p> blocks
  $adon=0;  //this is a variable so you don't show ads more than once.
  foreach($save as $item) {
    echo $item;  //print the <p> block
    echo "</p>"; 
    if(preg_match('/<p> /',$item)==0 && $tcount>=1 && $adon==0) {
                                $adon=1;
?>

text goes here

<?php
    }
 if(preg_match('/<p> /',$item)==0 && $tcount>=4 && $adon==1) {
                                $adon=2;
?>

<?php
   }
   $tcount++;
 }
?>
0
Posted on 10:54 AM by Softminer and filed under

1. to disable auto draft you have to add in wp-cofig.php this line
define(’WP_POST_REVISIONS’, false);

2.in older version of wordress:

Select "wp-admin" folder. Scroll down and select "post-new.php" file.
Locate the line code titled "wp_enqueue_script('autosave')." Delete this line in order to disable the "auto save" draft feature on your new posts.

3. in functions.php in your wp-content/theme folder
remove_post_type_support( 'post', 'revisions' );
0
Posted on 1:16 AM by Softminer and filed under , ,

Sometime in ajax controller u wanna return back error message and Onfailure will be called only if status code is 500 and usually this error is handled by IIS, to skip this error do following:

Server.ClearError();
Response.StatusCode = 500;
Response.TrySkipIisCustomErrors = true;


+
0
Posted on 5:33 AM by Softminer and filed under

public void ProcessRequest(HttpContext context)
    {
        String FileName = "Test.mp4";
        String FilePath = "Test.mp4";
        System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
        response.ClearContent();
        response.Clear();
        response.ContentType = "video/mpeg";
        response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
        response.AppendHeader("Access-Control-Allow-Origin", "*");
        response.TransmitFile(FilePath);
        response.Flush();
        response.End();  

    }


Here is an example of Range-Specific Request in ASP.NET
, Sample
0
Posted on 8:56 AM by Softminer and filed under

Visual studio should run as Administrator:

Process cmd = new Process();
            ProcessStartInfo info = new ProcessStartInfo(@"cmd.exe", "");
            info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            info.WorkingDirectory = @"c:\";
            info.RedirectStandardInput = true;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError = true;
            info.UseShellExecute = false;
            info.CreateNoWindow = true;

            cmd.StartInfo = info;
            cmd.Start();

            cmd.StandardInput.WriteLine(@"c:\Windows\system32\inetsrv\appcmd 
            recycle apppool /apppool.name:DefaultAppPool");

            cmd.StandardInput.Flush();
            cmd.StandardInput.Close();
            string output = cmd.StandardOutput.ReadToEnd();
0
Posted on 1:53 AM by Softminer and filed under


<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" />

+
+
0
Posted on 1:49 AM by Softminer and filed under

Usually when you install .net framework 4 you have following application pool:

ASP.NET v4.0
ASP.NET v4.0 Classic

if you have already .net framework 4 and you don't see application pool do the following steps:

Open your command prompt as administrator
Type cd C:\Windows\Microsoft.NET\Framework\v4.0.30319\ and press ENTER.
Type aspnet_regiis.exe -ir and press ENTER again.
If this is a fresh version of IIS (no other sites running on it) or you're not worried about the hosted sites breaking with a framework change you can use -i instead of -ir.
You should now see ASP.NET v4.0 listed

+