Simple get Instagram feed url

1. go to to create access token.

2. set OAuth URI as

3. paste “client id” at to get access token.

4. go to to user ID.

5. replace the value from 4. & 5. into this link[USER ID]/media/recent?access_token=[ACCESS TOKEN]

6. you can limit the feed quantity by add &count=10 after feed url above as[USER ID]/media/recent?access_token=[ACCESS TOKEN]&count=10

7. done.

PHP: Find image in text string

    $texthtml = 'Who is Sara Bareilles on Sing Off<br>
    <img alt="Sara" title="Sara" src="475993565.jpg"/><br>
    <img alt="Sara" title="Sara two" src="475993434343434.jpg"/><br>';
    preg_match('/<img.+src=[\'"](?P<src>.+)[\'"].*>/i', $texthtml, $image);
    echo $image['src'];

Remove browser input auto fill color by css

add the following code into your css.

input:-webkit-autofill {
    -webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
    -webkit-text-fill-color: #333;

input:-webkit-autofill:focus {
    -webkit-box-shadow: /*your box-shadow*/,0 0 0 50px white inset;
    -webkit-text-fill-color: #333;

metabox type file upload

$meta_boxes[] = array(
        'id'         => 'background_image',
        'title'      => 'Background Image',
        'pages'      => array( 'page' ), // Post type
        'show_on' => array( 'key' => 'id', 'value' => array( 9, 24, 11 ) ),
        'context'    => 'normal',
        'priority'   => 'high',
        'show_names' => true, // Show field names on the left
        'fields'     => array(
                'name' => 'Background Image',
                'desc' => 'Suba o seleccione la imagen a utilizar en el fondo de esta página.',
                'id' => $prefix . 'back_image',
                'type' => 'file',
                'save' => array('url','id'),
                'allow' => array('attachment')

Add Expire Header

Add the following code to .htaccess file to help improve speed your website.

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------

# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache

# If you don't use filenames to version, lower the CSS and JS to something like
# "access plus 1 week".

<IfModule mod_expires.c>
  ExpiresActive on

# Your document html
  ExpiresByType text/html "access plus 0 seconds"

# Media: images, video, audio
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# CSS and JavaScript
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"

How to Setting VirtualHosts in XAMPP on Mac

1. Enable VirtualHosts

Open the file “httpd.conf” which locate at:
/Applications/XAMPP/xamppfile/etc/httpd.conf by Textwrangler or other text editor.
Look for the following lines:

# Virtual hosts
#Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

Uncomment the second line by removing the hash (#), so that Apache loads your custom VirtualHosts configuration file:

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

2. Add Your Custom VirtualHosts

Open the file /Applications/XAMPP/xamppfile/etc/extra/httpd-vhosts.conf.
At the bottom of the file, add ‘localhost’ as the default named VirtualHost:

# localhost
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/Applications/XAMPP/htdocs"
    <Directory "/Applications/XAMPP/htdocs">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Order Allow,Deny
        Allow From All

After you add the default localhost. Now you can add your own virtualhosts

# mysite.local
<VirtualHost *:80>
    ServerName mysite.local
    DocumentRoot "/Users/phichamon/Public/mysite/"
    <Directory "/Users/phichamon/Public/mysite/">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow From All
    ErrorLog "logs/mysite.local-error_log"

In the example you can replace “mysite.local” with your own hostname.

3. Edit hosts file

Once you’ve saved your httpd.conf and httpd-vhosts.conf files, the next step is to edit your OSX hosts file by open the Terminal instance, and at the prompt type the following command:

sudo nano /etc/hosts

Enter your OSX password when prompted, and the hosts file will be opened in the nano text editor. You’ll see that the hosts file already contains some default hostname mappings (e.g. “ localhost”). Use your keyboard’s arrow keys to navigate to the bottom of the file and add your own mapping:

# XAMPP VirtualHost mappings mysite.local

4. Restart Apache

So that your changes take effect, restart Apache. This can be done using XAMPP Control, which is found at /Applications/XAMPP/XAMPP

Point your browser at http://mysite.local (or whatever ServerName you chose) and you should see your website.

if you have error about server error you can fix by change the file permission by add the following command on terminal.

chmod 755 /Users/phichamon/Public/mysite/
sudo chmod -R 755 /Users/phichamon/Public/mysite/

list post with category by wp_list_categories

wp_list_categories( array(
    'walker' => new Walker_Category_Posts()
) );

class Walker_Category_Posts extends Walker_Category {

    function start_el(&$output, $category, $depth, $args) {

        $this->category = $category;

        parent::start_el($output, $category, $depth, $args);

    function end_el(&$output, $page, $depth, $args) {
        if ( 'list' != $args['style'] )

        $posts = get_posts( array(
            'cat' => $this->category->term_id,
            'numberposts' => 3,
        ) );

        if( !empty( $posts ) ) {

            $posts_list = '<ul>';

            foreach( $posts as $post )
                $posts_list .= '<li><a href="' . get_permalink( $post->ID ) . '">'.get_the_title( $post->ID ).'</a></li>';

            $posts_list .= '</ul>';
        else {
            $posts_list = '';

        $output .= "{$posts_list}</li>\n";