Skip to content

Instantly share code, notes, and snippets.

@groucho75
groucho75 / merging_wp_queries.php
Last active March 1, 2023 09:43
Merging results of 2 WP_Query
<?php
/**
* Case: related news
*
* At first query for posts of same category, then, if it doesn't find enough posts, query for other posts and merge the 2 results.
*
* Put the following code inside a single template.
*
* @link Inspired by http://wordpress.stackexchange.com/questions/71576/combining-queries-with-different-arguments-per-post-type#answer-71582
@groucho75
groucho75 / alo-cf7-integration.php
Last active June 11, 2016 01:17
ALO-CF7 Integration - Updated
function my_easymail_add_subscriber ( $cf7 ) {
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$fields['email'] = $data["your-email"];
$fields['name'] = $data["your-name"];
if ( function_exists ('alo_em_add_subscriber') && is_email( $fields['email'] ) )
{
alo_em_add_subscriber( $fields, 1, alo_em_get_language(true) );
@groucho75
groucho75 / nav-menu-exporter-importer.php
Created November 10, 2016 16:23 — forked from raynov/nav-menu-exporter-importer.php
[WordPress Plugin] Nav Menu Exporter and Importer / Export and Import nav menus. Requires WordPress Importer plugin.
<?php
/*
Plugin Name: Nav Menu Exporter and Importer
Description: Export and Import nav menus. Requires WordPress Importer plugin
Author: hissy, megumi themes
Version: 0.1
Text Domain: nav-menu-exporter-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/