Skip to content

Instantly share code, notes, and snippets.

View pickplugins's full-sized avatar
🏠
Working from home

PickPlugins pickplugins

🏠
Working from home
View GitHub Profile
add_filter('wcps_slider_query_args', 'wcps_slider_query_args_custom', 10, 2);
function wcps_slider_query_args_custom($query_args, $args)
{
$wcps_id = isset($args['wcps_id']) ? (int) $args['wcps_id'] : 0;
if ($wcps_id == '877') {
// do for wcps id 877
$query_args['tax_query'] = array(
remove_action('related_post_loop_item_element_post_thumb', 'related_post_loop_item_element_post_thumb', 10, 2);
add_action('related_post_loop_item_element_post_thumb', 'related_post_loop_item_element_post_thumb_20200126', 10, 2);
function related_post_loop_item_element_post_thumb_20200126($loop_post_id, $elementData)
{
//$option_id_value = isset($elementData['option_id']) ? $elementData['option_id'] : '';
//$post_meta_value = get_post_meta($loop_post_id, 'meta_key', true);
function post_grid_query_args_20200429($query_args, $args){
$query_args['tag'] = 'tag 1, tag 2, tag 3';
return $query_args;
}
add_filter('post_grid_query_args','post_grid_query_args_20200429', 10, 2);
remove_action('qa_question_submitted', 'qa_question_submitted_notification', 50, 2);
add_action('qa_question_submitted', 'qa_question_submitted_notification_custom', 50, 2);
function qa_question_submitted_notification_custom($question_ID, $post_data)
{
$q_category = get_the_terms($question_ID, 'question_cat');
var post_content = `<!-- wp:paragraph -->
<p>Hello</p>
<!-- /wp:paragraph -->
<!-- wp:list -->
<ul>
<li>hello 1</li>
<li>hello 2</li>
<li> </li>
</ul>
var content = "Test content";
var name = 'core/paragraph';
// var name = 'core/html';
var insertedBlock = wp.blocks.createBlock(name, {
content: content,
});
wp.data.dispatch('core/editor').insertBlocks(insertedBlock);
// Server Side
add_action('init', 'get_request_args');
public function get_request_args(){
if (isset($_REQUEST['args'])) {
$json = isset($_REQUEST['args']) ? sanitize_text_field($_REQUEST['args']) : '';
Seleceted: Your latest posts
// if(is_front_page() && is_home())
Seleceted: A static page (select below)
Homepage:
// if( is_front_page())
Posts page:
function me_search_query( $query ) {
if ( $query->is_search ) {
$meta_query_args = array(
array(
'key' => 'accordions_options',
'value' => $query->query_vars['s'] = '',
'compare' => 'LIKE',
),
);
$query->set('meta_query', $meta_query_args);
add_action('post_grid_layout_element_title_link', 'post_grid_layout_element_title_link_20210615');
function post_grid_layout_element_title_link_20210615($args){
$element = isset($args['element']) ? $args['element'] : array();
$elementIndex = isset($args['index']) ? $args['index'] : '';
$post_id = isset($args['post_id']) ? $args['post_id'] : '';