Plugin Directory

Changeset 640509

Timestamp:
12/17/2012 12:52:26 PM (12 years ago)
Author:
MZAWeb
Message:

Fix Readme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-log-in-browser/trunk/README.txt

    r640503 r640509  
    3030For example, to log all your main query's query_vars:
    3131
    32 ```add_filter( 'pre_get_posts', 'log_wp_query', 10000 );
     32`add_filter( 'pre_get_posts', 'log_wp_query', 10000 );
    3333
    3434function log_wp_query( $query ) {
     
    3737
    3838    return $query;
    39 }```
     39}`
    4040
    4141= Filters =
     
    6161Example 1: Sequential use, log manually.
    6262
    63 ```browser()->timer( 'Mega loop' );
     63`browser()->timer( 'Mega loop' );
    6464for ( $i = 0; $i < 1000000; $i++ ) {
    6565    //do something
    6666}
    6767$time = browser()->timer( 'Mega loop' );
    68 browser()->log( $time, 'The mega loop took:' );```
     68browser()->log( $time, 'The mega loop took:' );`
    6969
    7070Example 2: Start and end in different places, log automatically.
    7171
    72 ```add_action( 'posts_selection', 'start_timer', 100 );
     72`add_action( 'posts_selection', 'start_timer', 100 );
    7373add_filter( 'the_posts', 'end_timer', 1, 2 );
    7474
     
    8080    browser()->timer( 'Main query time', true );
    8181    return $posts;
    82 }```
     82}`
    8383
    8484*This is not a good way of measuring how much time a query takes to run, it's just to illustrate how to use the timer.*
     
    9292Example:
    9393
    94 ```Browser()->memory( 'testing' );
     94`Browser()->memory( 'testing' );
    9595$test = array();
    9696for ( $i = 0; $i < 100; $i++ ) {
     
    105105    $test[$i] = md5( rand( 1, $i ) );
    106106}
    107 Browser()->memory( 'testing', true );```
     107Browser()->memory( 'testing', true );`
    108108
    109109== Installation ==
Note: See TracChangeset for help on using the changeset viewer.