using wordpress CLI to post to wordpress

2011-03-24 1 min read Bash Wordpress

There is a very nice post here: How to post content to a WordPress blog from the command line

I tried this in Fedora 14 and here is the way to get this working in Fedora

  <td>
    <div class="text codecolorer">
      su -<br /> <br /> cpan<br /> <br /> install WordPress::CLI WordPress::Post
    </div>
  </td>
</tr>
1
2
3
4
5

Now, once the above completes make sure that the path /usr/local/bin is in you path.

Continue reading

analyze debug queries output for wordpress

2011-02-09 2 min read Wordpress

Some time back, my website became too slow and I started getting timeout response for quite a lot of my pages. When I analyzed things, I found the issue was with the DB queries taking a lot of time. So, I thought of getting my hands dirty and started with installing the plugin “Debug Queries”. Just in case, you don’t know about the plugin, it lists all the queries to DB along with the time taken for the query when a Admin user visits any page.

Continue reading

Performance issues resolved with my blog.

2010-10-01 1 min read Uncategorized

For last 2-3 weeks there were quite a lot of performance issues with my website. I was looking at the same but could not get enough time to have all of them resolved together. Finally I have spent time on my web hosting and wordpress installation to resolve these issues.

I have taken this opportunity to optimize the blog also. Now the page loading time should be much lesser and you should not be seeing any issues with respect to the site performance or un-availability. If you do see some issues, leave me a comment or contact me through contact me page.

Continue reading

Adding a sub-menu in the wordpress admin menu :)

2010-07-29 2 min read Wordpress

For the impatient ones, first the code:
(in wp-admin folder, open the file menu.php) and locate the code:

$submenu[&#8217;edit.php&#8217;][10]  = array( _x(&#8217;Add New&#8217;, &#8217;post&#8217;), &#8217;edit_posts&#8217;, &#8217;post-new.php&#8217; );

and add the below:

$submenu[&#8217;edit.php&#8217;][7]  = array( _x(&#8217;Pending&#8217;, &#8217;post&#8217;), &#8217;edit_posts&#8217;, &#8217;edit.php?post_status=pending&post_type=post&#8217; );

And now the explanation and why do you need this 🙂

Problem:

There is no direct mechanism to access the pending posts in WP admin. I generally post through email and mark them as pending. So, whenever I go to my admin POSTs page, I will look through the list of pending items and post them as and when required. For this, when I am done with changes in one item, I need to either modify the address bar or need to go to posts link and then click the Pending items.

Continue reading

Getting your wordpress self hosted stats on your console with bash script.

2010-06-29 3 min read Bash Learning

Some time back I wrote a blog on how to get your site stats using curl in <a class="zem_slink freebase/en/bash" title="Bash" rel="homepage" href="http://tiswww.case.edu/php/chet/bash/bashtop.html">bash shell. Today we will use the same script to get the stats every few seconds on the terminal on the same line, similar to progress meter.

Here is the script and the description:

  <td>
    <div class="bash codecolorer">
      <span class="co0">#!/bin/bash -</span><br /> <span class="co0">#===============================================================================</span><br /> <span class="co0">#</span><br /> <span class="co0">#          FILE:  update_stats.sh</span><br /> <span class="co0">#</span><br /> <span class="co0">#         USAGE:  ./update_stats.sh</span><br /> <span class="co0">#</span><br /> <span class="co0">#   DESCRIPTION:  Update the stats inline in shell every $1 seconds.</span><br /> <span class="co0">#</span><br /> <span class="co0">#       OPTIONS:  ---</span><br /> <span class="co0">#  REQUIREMENTS:  ---</span><br /> <span class="co0">#          BUGS:  ---</span><br /> <span class="co0">#         NOTES:  ---</span><br /> <span class="co0">#        AUTHOR:  <a class="zem_slink" title="Amit Agarwal" rel="homepage" href="http://amit-agarwal.co.in">Amit Agarwal</a> (AKA), amit.agarwal@amit-agarwal.co.in</span><br /> <span class="co0">#       COMPANY:  Individual</span><br /> <span class="co0">#       VERSION:  1.0</span><br /> <span class="co0">#       CREATED:  06/21/2010 11:27:16 PM IST</span><br /> <span class="co0">#      REVISION:  ---</span><br /> <span class="co0">#===============================================================================</span><br /> <br /> <span class="re2">sleep_time</span>=<span class="nu0">30</span> <span class="co0">#the time to wait between stats collection</span><br /> <span class="re2">run_stats</span>=get_stats  <span class="co0"># the script to run to get the stats</span><br /> <span class="re2">filename</span>=<span class="sy0">/</span>tmp<span class="sy0">/</span>statpress.html <span class="co0"># the filename where the script is storing the html file of your statpress page.</span><br /> <span class="kw3">eval</span> <span class="re1">$run_stats</span> <span class="nu0">2</span><span class="sy0">><</span>a <span class="re2">class</span>=<span class="st0">"zem_slink freebase/en/dev_null"</span> <span class="re2">title</span>=<span class="st0">"/dev/null"</span> <span class="re2">rel</span>=<span class="st0">"wikipedia"</span> <span class="re2">href</span>=<span class="st0">"http://en.wikipedia.org/wiki//dev/null"</span><span class="sy0">>/</span>dev<span class="sy0">/</span>null<span class="sy0"></</span>a<span class="sy0">></span><br /> <span class="kw1">while</span> <span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span><br /> <span class="kw1">do</span><br /> <span class="sy0"><!</span>--loginview start--<span class="sy0">></span><span class="re2">values</span>=$<span class="br0">&#40;</span><span class="kw2">cat</span> <span class="re1">$filename</span> <span class="sy0">|</span> w3m <span class="re5">-dump</span> <span class="re5">-T</span> <span class="sy0"><</span>a <span class="re2">class</span>=<span class="st0">"zem_slink freebase/en/html"</span> <span class="re2">title</span>=<span class="st0">"HTML"</span> <span class="re2">rel</span>=<span class="st0">"wikipedia"</span> <span class="re2">href</span>=<span class="st0">"http://en.wikipedia.org/wiki/HTML"</span><span class="sy0">></span>text<span class="sy0">/</span>html<span class="sy0"></</span>a<span class="sy0">></span> <span class="sy0">|<</span>a <span class="re2">class</span>=<span class="st0">"zem_slink freebase/en/grep"</span> <span class="re2">title</span>=<span class="st0">"Grep"</span> <span class="re2">rel</span>=<span class="st0">"wikipedia"</span> <span class="re2">href</span>=<span class="st0">"http://en.wikipedia.org/wiki/Grep"</span><span class="sy0">></span><span class="kw2">grep</span><span class="sy0"></</span>a<span class="sy0">></span> <span class="st0">"^Visitor\\|^Pageviews"</span><span class="sy0">|<</span>a <span class="re2">class</span>=<span class="st0">"zem_slink freebase/en/awk"</span> <span class="re2">title</span>=<span class="st0">"AWK"</span> <span class="re2">rel</span>=<span class="st0">"homepage"</span> <span class="re2">href</span>=<span class="st0">"http://cm.bell-labs.com/cm/cs/awkbook/index.html"</span><span class="sy0">></span><span class="kw2">awk</span><span class="sy0"></</span>a<span class="sy0">></span> <span class="co3">\'</span><span class="br0">&#123;</span>print <span class="re4">$1</span><span class="nu0"></span><span class="br0">&#125;</span><span class="co3">\'</span><span class="sy0">|</span><span class="kw2">tr</span>  <span class="st0">"\<span class="es1">\n</span>"</span> <span class="st0">" "</span><span class="br0">&#41;</span><br /> <span class="re2">time</span>=$<span class="br0">&#40;</span><span class="kw2">date</span><span class="br0">&#41;</span><br /> <span class="kw3">printf</span> <span class="st0">"<span class="es2">$time</span> --> <span class="es2">$values</span> \<span class="es1">\r</span>"</span><span class="sy0"><!</span>--loginview end--<span class="sy0">></span><br /> <span class="kw2">sleep</span> <span class="re1">$sleep_time</span><br /> <span class="kw1">done</span>
    </div>
  </td>
</tr>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\"Enhanced

wordpress blog stats monitoring from remote using curl and bash and send it in mail.

2010-06-25 3 min read Bash Fedora Linux

Here&#8217;s something that I had been planning to do for sometime now. I have my blog on wordpress and have Statpress plugin installed. The plugin does give me a good idea of the visits to my site. Now, I have to keep logging in every now and then to check the stats. Also since I did not want to spend some more amount 🙂 so I do not have the shell access to the server, too bad 🙁

Continue reading

wordpress Fedora 11 desktop client.

2010-06-25 1 min read Fedora

Another wordpress client on Fedora for wordpress. Simple and easy to configure and use. Here&#8217;s how it looks.

sudo yum install lekhonee

<a href="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/screenshot-lekhonee.jpg"><img class="size-full wp-image-838" title="screenshot-lekhonee" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/screenshot-lekhonee.jpg" alt="screenshot-lekhonee" width="785" height="604" />

Older posts Newer posts