Skip to content

Instantly share code, notes, and snippets.

View tribulant's full-sized avatar

Tribulant tribulant

View GitHub Profile
@tribulant
tribulant / gist:664f2f1eec9bf8140c45
Created October 30, 2014 13:43
Order Items and Variations
<?php
global $wpcoDb, $Order, $Item, $Style, $Option;
$wpcoDb -> model = $Item -> model;
if ($items = $wpcoDb -> find_all(array('order_id' => $order -> id))) {
$variations = maybe_unserialize($item -> styles);
foreach ($variations as $variation_id => $option_id) {
@tribulant
tribulant / gist:58a3c0c294480ad43d9f
Created October 30, 2014 14:09
Remove [wpmlcontent]
<?php
function replace_wpmlcontent($body = null) {
return preg_replace("/\[wpmlcontent\]/si", "", $body);
}
add_filter('wpml_wpmlcontent_before_replace', 'replace_wpmlcontent', 10, 1);
?>
@tribulant
tribulant / gist:3fa36632690a0af54458
Created November 21, 2014 11:06
Remove some Newsletter plugin metaboxes
<?php
// www.tribulant.com
function remove_meta_boxes() {
remove_meta_box('listsdiv', 'newsletters_page_newsletters', 'normal');
remove_meta_box('publishdiv', 'newsletters_page_newsletters-create', 'normal');
}
add_action('admin_menu', 'remove_meta_boxes', 99, 1);
@tribulant
tribulant / gist:b2f6c3ffcde9d0381c00
Created November 25, 2014 11:02
Filter content of email
function replace_wpmlcontent($body = null) {
$newbody = preg_replace("/\[wpmlcontent\]/si", "testing this out", $body);
return $newbody;
}
add_filter('newsletters_theme_before_wpmlcontent_replace', 'replace_wpmlcontent', 10, 1);
<?php
add_filter('newsletters_theme_before_wpmlcontent_replace', 'replace_wpmlcontent', 10, 1);
function replace_wpmlcontent($body = null) {
//let's see if this is a post/page editing screen
//if it is, we'll replace the [wpmlcontent] code in the newsletter theme with nothing
if (preg_match("/(post\.php|post\-new\.php)/", $_SERVER['REQUEST_URI'], $matches)) {
return preg_replace("/\[wpmlcontent\]/si", "", $body);
@tribulant
tribulant / gist:c79419d7b9e292301a24
Created December 3, 2014 10:26
WordPress rewrite rules for CakePHP
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
@tribulant
tribulant / gist:d3e1f14ff998379e89cb
Created December 11, 2014 11:14
Latest Posts Code
<div class="wpmlposts">
[newsletters_post_loop]
<h2>[newsletters_category_heading]</h2>
<div class="wpmlpost">
<h3><a href="[newsletters_post_link]" title="[newsletters_post_title]">[newsletters_post_title]</a></h3>
[newsletters_post_date_wrapper]<p><small>Posted on [newsletters_post_date format="F jS, Y"] by [newsletters_post_author]</small></p>[/newsletters_post_date_wrapper]
<div class="wpmlpost_content">
[newsletters_post_thumbnail]
<p>[newsletters_post_excerpt]</p>
</div>
@tribulant
tribulant / gist:3f90cd7f851135285c26
Created December 17, 2014 18:57
Tribulant Software Buttons
.button {
display: inline-block;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font-size: 14px;
font-weight: bold;
padding: .6em 1em .7em 1em;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
.page-title {
background: url(images/[email protected]) no-repeat center center #194c6a;
background-size: 2500px;
}
}
<?php
if (class_exists('wpMail')) {
$wpMail = new wpMail();
if (!empty($_GET['page']) && in_array($_GET['page'], (array) $wpMail -> sections)) {
//run remove filters here...
}
}
?>