- Added related post id as second argument to 'rp4wp_post_excerpt' filter.
- Only run upgrade script if there are posts to upgrade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rp4wp_example_remove_hook() { | |
$hook_instance = RP4WP_Manager_Hook::get_hook_object( 'RP4WP_Hook_Frontend_Css' ); | |
remove_action( 'wp_head', array( $hook_instance, 'run' ), $hook_instance->get_priority() ); | |
} | |
add_action( 'init', 'rp4wp_example_remove_hook' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display related posts of current post | |
rp4wp_children(); | |
// Display related posts of specific post | |
rp4wp_children( 2 ); | |
// Return output instead of displaying it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rp4wp_change_post_excerpt_length( $excerpt_length ) { | |
return '10'; | |
} | |
add_filter( 'rp4wp_general_post_excerpt_length', 'rp4wp_change_post_excerpt_length' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Correct: | |
<?php echo $name; ?> | |
Incorrect: | |
<?= $name ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$shout = ( 'WordPress' === $cms ) ? 'Woo!' : 'Boo!'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( true == $result ) { | |
// Do something | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This works | |
*/ | |
add_option( 'verykey', 'wow' ); // Stored with key 'verykey' | |
echo get_option( 'verykey', '' ); // Outputs 'wow' | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The changelog path | |
$changelog_path = '/var/www/rp4wp/wp-content/plugins/related-posts-for-wp-premium/CHANGELOG.md'; | |
// Format the changelog from .md to HTML | |
$changelog = file_get_contents( $changelog_path ); | |
$changelog = preg_replace( "/###[ ]?([0-9\.]+): ([A-Z0-9 ,]+)/i", "<h3>$1</h3>" . PHP_EOL . "<i>$2</i>" . PHP_EOL . "<ul>", $changelog ); | |
$changelog = preg_replace( "/\* ([A-Z0-9 \._,'\(\)\/\-&\"\']+)/i", "<li>$1</li>", $changelog ); | |
$changelog = preg_replace( "/" . PHP_EOL . "<h3>/i", "</ul>" . PHP_EOL . PHP_EOL . "<h3>", $changelog ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |