Pacecode Blog

Tips,Ideas, Free scripts and more…

Follow me on TwitterRSS Feeds

  • Home
  • interview questions
  • joomla
  • mootools
  • mysql questions
  • oscommerce

Customizing the Read More link with WordPress

Sep 23rd

Posted by Raja MM in web 2.0

No comments

If you have set your WordPress site to display post excerpts on the front or home page, you will want visitors to click on the title or a link to encourage them to continue reading your post or article, right? WordPress makes this technique easy, and customizable.

Here is the steps:

  • Go to wordpress admin panel –> Design tab –> Theme Editor.
  • Select Main Index template (index.php) to edit it
  • Find the line  “<?php the_content(‘Read the rest of this entry &raquo;’); ?>”
  • And replace it with the following code.

<?php

$content = get_the_content($more_link_text, $stripteaser, $more_file);
if(strlen($content)>500) // chanage 500 as per your needs
{
$part_msg=substr($content, 0, 500);// chanage 500 as per your needs
echo ‘<p>’.$part_msg.’… ‘;
?>
<br /><br />
<a href=”<? comments_link(); ?>”>Read More…</a></div>
<?php
echo ‘</p>’;
}
else
{
echo ‘<p>’.$content.’</p></div>’;
}

?>

Where “500″ represents number of characters that you want to show.

If you cannot able to make the above changes with the wordpress theme editor, use your ftp.

Here is the template directory

/public_html/blog/wp-content/themes

or

/www/blog/wp-content/themes

where blog is the directory where i installed my wordpress

Share this post

Add to Buzz Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks
Add to Mister Wong Add to Netscape Add to reddit Add to Stumble Upon Add to Technorati
Add to Tip'd Add to Twitter Add to Yahoo My Web
blogging tips, wordpress codex, wordpress cutomization, wordpress freelancers, wordpress latest tips, wordpress programmer, wordpress readmore link, wordpress scripting tips, wordpress theme developer

Problem with WordPress admin-login? or Forgot your WordPress admin password?

Sep 23rd

Posted by Raja MM in php developers

No comments

Reset your local wordpress password easily

While building my theme I installed wordpress with lots of sample data and I realized.

mysql picture

mysql picture

I forgot my password and couldn’t recover it even with a “forgot password” link. So after

playing around for 30 mins, I reset my password. This is how.

WordPress admin login error happen for two following reason:

  1. User may forgot the admin password
  2. User might have entered wrong site url in setting tab

go to your mysql administrator (usually called as phpmyadmin)

  • select your wordpress database
  • run the following update query with your password as in bracket using sql tab

SELECT ‘wordpress’ //this should be your database name
UPDATE `wp_users` SET `user_pass` = MD5( ‘password’ ) WHERE `ID` =1 LIMIT 1 ;

where password is your new password. Your password is reset, for the admin acount.

For admin side login problem, there might be another reason. You might have given wrong site

url. This can be update by the following query

UPDATE `wp_options` SET `option_value` = ‘You site url’ WHERE `wp_options`.`option_id` =1

LIMIT 1 ;

It will update your site url in the wp_options table and it will solve your login error.

Share this post

Add to Buzz Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks
Add to Mister Wong Add to Netscape Add to reddit Add to Stumble Upon Add to Technorati
Add to Tip'd Add to Twitter Add to Yahoo My Web
forgot wordpress password, reset wordpress admin login, updating wordpress admin password, wordpress admin problem, wordpress admin redirection error, wordpress login error, wordpress md5 password

Magic with htaccess file – Increase execution time, session expiry time and file upload size limit

Sep 22nd

Posted by Raja MM in htaccess

6 comments

<IfModule mod_php5.c>
php_value post_max_size 5M
php_value upload_max_filesize 5M
php_value memory_limit 300M
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.gc_maxlifetime 1200
</IfModule>

php_value memory_limit 300M – Set higher default php_value memory_limit in .htaccess

upload_max_filesize 5M - it increases default upload limit. The default upload limit is 2MB. the above htaccess increase increases file limit 2mb to 5 mb

php_value max_execution_time:

Set the number of seconds a script is allowed to run. If this is reached,
the script returns a fatal error. The default limit is 30 seconds or, if it
exists, the max_execution_time value defined in the configuration file. If
seconds is set to zero, no time limit is imposed.

php_value session.gc_maxlifetime:

The session.gc_maxlifetime only sets the age of the session files that will be deleted when

garbage collection runs.

If you have a busy web site with a lot of sessions being created, garbage collection will

run based on session.gc_probability/session.gc_divisor. Despite this being called

“probability” I tested this and it is strictly a count. Using the default

gc_probability/gc_divisor of 1/100, this means that garbage collection will run every 100

new sessions (Edit: Actually this occurs within the session_start() coding and would count

re-started sessions as well) and delete any existing session files that are older than the

session.gc_maxlifetime. There is no file locking on the session files, so active session

files will be deleted and things like users getting logged out will occur.

If this is on shared hosting and the session files are all kept in the default location and

someone else is using a smaller session.gc_maxlifetime or a more frequent

gc_probability/gc_divisor, then any of the session files will get deleted based on the

lowest value of gc_maxlifetime and the most frequent gc_probability/gc_divisor.

You need to increase session.gc_maxlifetime or make session.gc_divisor larger and if this is

on shared hosting, set session.save_path to be a location within your web space.

Share this post

Add to Buzz Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks
Add to Mister Wong Add to Netscape Add to reddit Add to Stumble Upon Add to Technorati
Add to Tip'd Add to Twitter Add to Yahoo My Web
all in one htaccess process, handling server variable with htaccess, htaccess and php ini, htaccess for file execution time, htaccess for file upload limit, htaccess for sesssion expiry, htaccess to increase memory limit, magic with htaccess, server configuration file changes with htaccess

Part of Page refresh using AJAX with timed delay

Sep 21st

Posted by Raja MM in page refresh

2 comments

<head>
<script type=”text/javascript”>
function makAx() // this function to activate XMLHttpRequest Object
{
try
{
xm = new ActiveXObject(“Msxml2.XMLHTTP”);
return true;
}
catch (e)
{
try
{
xm = new ActiveXObject(“Microsoft.XMLHTTP”);
return true;
}
catch (e2)
{
xm = false;
}
}
if (!xm && typeof XMLHttpRequest != ‘undefined’)
{
xm = new XMLHttpRequest();
return true;
}
}
function showImages()
{
if(makAx()) // XMLHttpRequest checked here
{
url = “external-page-for-db-query.php”; // this file will contains your db query
callavail();
}
}
function callavail()
{
xm.open(“GET”,url,true); // This is ajax functionality. It may have true(for synchronous request) or false(for asynchronous request)
xm.onreadystatechange = cavail;
xm.send(null);
}
function cavail()
{
if(xm.readyState == 4) // If ready state reached
{
var response = xm.responseText;
var str = document.getElementById(“showResult”); // result of “external-page-for-db-query.php” will come here
str.innerHTML = response;
setTimeout(“showImages()”,1000); // here 1000 represents one second for time delay. showImage() function will be called with the specified time delay
}
}
</script>
</head>

<body>
<div id=”showResult”></div> <!–page result will be displayed here–>
</body>
</html>

Share this post

Add to Buzz Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks
Add to Mister Wong Add to Netscape Add to reddit Add to Stumble Upon Add to Technorati
Add to Tip'd Add to Twitter Add to Yahoo My Web
auto page refresh using javascript, javascript helpers zone, javascript latest script, javascript page refresh, js page refresh, page refresh using javascript, page refresh with time delay

Part of page refresh with time delay using MockAJAX – Facebook Developers

Sep 21st

Posted by Raja MM in facebook javascript

No comments

A Simple script that make our application works great. Yes, The following FBJS – FaceBook JavaScript will help you for part of page refresh in the facebook applications.

Uses:

1) Helps to retrieve data from your server database without refreshing the page
2) It would be useful for cricket scores and other live datas.

Mock AJAX Script as follows,

<script>

<!–
function partRefresh(){

var ajax = new Ajax();

ajax.responseType = Ajax.FBML;

ajax.ondone = function(data) {

document.getElementById(’partId’).setInnerFBML(data);

setTimeout(function() {partRefresh()},60000); // Making time delay

}
ajax.post(“http://www.example.com/filename.php”);
}
//–>
</script>

<div id=”partId”></div> // the output of filename.php is displayed here
<script>
partRefresh(); // Just calling the function on browser loads
</script>

Share this post

Add to Buzz Add to Del.icio.us Add to digg Add to Facebook Add to Google Bookmarks
Add to Mister Wong Add to Netscape Add to reddit Add to Stumble Upon Add to Technorati
Add to Tip'd Add to Twitter Add to Yahoo My Web
ajax page refresh, facebook developer zone, facebook javascript, fbjs page refresh, fbjs script, java script page refresh, javascript for facebook developers, part of page refresh
«12
  • Categories

    • ajax calendar
    • creloaded
    • facebook javascript
    • htaccess
    • interview questions
    • Javascripts
    • joomla
    • jQuery
    • mootools
    • mysql questions
    • oscommerce
    • page refresh
    • php calendar
    • php developers
    • php interview questions
    • php questions
    • php scripts
    • server configuration
    • virtuemart
    • web 2.0
    • wordpress
  • Calendar

    September 2010
    M T W T F S S
    « Aug    
     12345
    6789101112
    13141516171819
    20212223242526
    27282930  
  • I am a freelancer and Experienced in Opensource Tools such as Wordpress, Joomla, FaceBook application development and CakePHP.

    Please feel free to contact yadheendran@gmail.com for Website projects.

    oDesk Certified Wordpress Developer oDesk Certified PHP5 Developer oDesk Certified AJAX Developer
  • Archives

    • August 2010
    • April 2010
    • April 2009
    • December 2008
    • October 2008
    • September 2008
  • Spam Blocked

    1,412 spam comments blocked by
    Akismet
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top