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
update_post_meta( $post_id, '_wp_page_template', 'page-contact.php' ); |
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 | |
/** | |
* Block helpers | |
* add special classes when certain blocks appear, put this in your functions.php file or include it somewhere | |
*/ | |
// add block classes in body and post class | |
function blocks_body_class( $classes ) { | |
global $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 | |
if (is_page('Contact')) { | |
wp_register_script( 'contact-form', 'http://ajax.googleapis.com/contact-form.js'); | |
wp_enqueue_script( 'contact-form' ); | |
} | |
?> |
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
// toss this in your functions.php (or elsewhere) | |
function get_shorty($count = 15){ | |
global $post; | |
$str = get_the_content(); | |
$str = implode(' ', array_slice(explode(' ', $str), 0, $count)); | |
return $str.'...'; | |
} |
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 | |
// ... the rest of your file here | |
acf_register_block_type(array( | |
'name' => 'hero', | |
'title' => __('Hero'), | |
'description' => __('A custom hero block.'), | |
'render_template' => 'template-parts/blocks/hero/hero.php', | |
'category' => 'formatting', |
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
<? | |
if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['insert_post'] )) { //check that our form was submitted | |
$title = $_POST['thread_title']; //set our title | |
if ($_POST['thread_description']=="") { // check if a description was entered | |
$description = "See thread title..."; // if not, use placeholder | |
} else { | |
$description = $_POST['thread_description']; //if so, use it |
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
{ | |
// The tab key will cycle through the settings when first created | |
// Visit http://wbond.net/sublime_packages/sftp/settings for help | |
// sftp, ftp or ftps | |
"type": "sftp", | |
"save_before_upload": true, | |
"upload_on_save": false, | |
"sync_down_on_open": false, |
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 | |
/** | |
* Block whitelist | |
* Only allow certain blocks to be used | |
*/ | |
add_filter( 'allowed_block_types', 'our_allowed_block_types' ); | |
function our_allowed_block_types( $allowed_blocks ) { |
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 | |
//let's get some tweets!! | |
//first, let's see if I've got the data already cached | |
$tweets = get_transient("tweets"); | |
//dang it! it looks like I might not. let's grab some tweets from the Twitter API | |
if( !$tweets ) { |
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
add_filter('acf/format_value/type=textarea', 'do_shortcode'); | |
NewerOlder