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 | |
/** | |
* Add a 'Add rel="nofollow" to link' checkbox to the WordPress link editor | |
* | |
* @see https://danielbachhuber.com/tip/rel-nofollow-link-modal/ | |
*/ | |
add_action( 'after_wp_tiny_mce', function(){ | |
?> | |
<script> |
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 | |
$show_after_p = 2; | |
$content = apply_filters('the_content', $post->post_content); | |
if(substr_count($content, '<p>') > $show_after_p) | |
{ | |
$contents = explode("</p>", $content); | |
$p_count = 1; | |
foreach($contents as $content) | |
{ | |
echo $content; |
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
function my_relationship_query( $args, $field, $post_id ) { | |
// only show children of the current post being edited | |
$args['post_date'] = 'DESC'; | |
// return | |
return $args; | |
} |
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( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'via_sector' == $params['facet_name'] ) { | |
$values = (array) $params['facet_value']; // an array of post IDs (it's already unserialized) | |
foreach ( $values as $val ) { | |
$params['facet_value'] = $val; | |
$params['facet_display_value'] = get_the_title( $val ); | |
$class->insert( $params ); // insert each value to the database | |
} |
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 | |
return array( | |
"post_type" => "via", | |
"post_status" => "publish", | |
"orderby" => "ID", | |
"order" => "DESC", | |
"posts_per_page" => 10, | |
"meta_query" => array( | |
array( | |
"key" => "sector_via", |