This file contains 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 | |
// Limit the comment length to 6000 characters and a minimum of 50 characters in WordPress | |
add_filter( 'preprocess_comment', 'smartwp_limit_comment_length' ); | |
function smartwp_limit_comment_length( $comment ) { | |
// Limit the comments to 6000 characters | |
if ( strlen( $comment['comment_content'] ) > 6000 ) { | |
wp_die('Comment is too long. Comments must be under 6000 characters.'); | |
} | |
This file contains 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
/* | |
Theme Name: Twenty Fifteen Child | |
Description: Twenty Fifteen Child Theme | |
Author: John Doe | |
Author URI: http://example.com | |
Template: twentyfifteen | |
Version: 1.0.0 | |
Text Domain: twentyfifteenchild | |
*/ |
This file contains 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 | |
global $product; | |
echo 'The current product ID is: '.$product->get_id(); |
This file contains 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_value memory_limit 256M |
This file contains 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 | |
// Update a post programmatically | |
$my_post_id = 15 | |
$update_post = array( | |
'ID' => $my_post_id, | |
'post_title' => 'My new post title', | |
'post_content' => 'Overwrite post content', | |
'post_status' => 'public' | |
); |
This file contains 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 | |
// Insert custom post programmatically | |
$new_post = array( | |
'post_title' => 'My new example post', | |
'post_content' => 'My new content!', | |
'post_status' => 'public', | |
'post_type' => 'my_post_type' | |
); | |
$post_id = wp_insert_post( $new_post ); |
This file contains 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 | |
// Insert post programmatically | |
$new_post = array( | |
'post_title' => 'My new post', | |
'post_content' => 'Content to insert.', | |
'post_status' => 'publish' | |
); | |
$post_id = wp_insert_post( $new_post ); |
This file contains 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 | |
// Get the ID of the featured image | |
echo get_the_post_thumbnail( get_the_ID(), 'large' ); |
NewerOlder