Archive

Archive for December, 2015

Iterate object object array in php

December 28, 2015 Leave a comment

      15down voteaccepted

you dont need to convert them to anything.

foreach loop would work fine with you as follows in generic:

foreach ($objects as $obj) {
   echo $obj->property;
}

for a inner object this would work:

foreach ($objects as $obj){
      echo $obj->user->description;
}

 

 

http://stackoverflow.com/questions/8664208/how-to-loop-through-objects-in-php

Categories: Techanical

Jquery ajax submit

December 23, 2015 Leave a comment
Categories: Techanical

jquery light box via iframe

December 21, 2015 Leave a comment
Categories: Techanical

Post meta query search in wordpress

December 18, 2015 Leave a comment

$args = array(
‘post_type’ => ‘post’,
‘post__in’ => $unique,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1
);

$posts = get_posts($args);

 

check these lines

 

http://wordpress.stackexchange.com/questions/78649/using-meta-query-meta-query-with-a-search-query-s

 

 

Categories: Techanical

WordPress wpdb undefined variable

December 14, 2015 Leave a comment
Categories: Techanical

Get ip address of our local system Via php code

December 14, 2015 Leave a comment

function getLocalIP(){
exec(“ipconfig /all”, $output);
foreach($output as $line){
if (preg_match(“/(.*)IPv4 Address(.*)/”, $line)){
$ip = $line;
$ip = str_replace(“IPv4 Address. . . . . . . . . . . :”,””,$ip);
$ip = str_replace(“(Preferred)”,””,$ip);
}
}
return $ip;
}

echo $ip = getLocalIP(); //This will return: 192.168.x.x (Your Local IP)

Categories: ajax, Techanical

How to redirect URLs based on query string?

December 8, 2015 Leave a comment
Categories: Techanical

One Url to another url via htaccess

December 8, 2015 Leave a comment

RewriteRule ^article/?$ http://www.new-domain.com/article/ [R=301,NC,L] # Permanent Move

If the move is permanent, append “=301” to the “R” flag to have Apache tell the browser the move is considered permanent. Unlike the default “R”, “R=301” will also tell the browser to display the new address in the address bar.

This is one of the most common methods of rewriting URLs of items that have moved to a new URL (for example, it is in use extensively on this site to forward users to new post URLs whenever they are changed).

 

 

https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/