Version Description
- Fixed bug with post category selections causing campaigns to load globally.
Download this release
Release Info
| Developer | griffinjt |
| Plugin | |
| Version | 1.1.5.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.5.1 to 1.1.5.2
- OMAPI/Output.php +43 -40
- optin-monster-wp-api.php +2 -2
- readme.txt +3 -0
OMAPI/Output.php
CHANGED
|
@@ -519,52 +519,55 @@ class OMAPI_Output {
|
|
| 519 |
}
|
| 520 |
|
| 521 |
// If the optin is only to be shown on particular categories, get the code and break.
|
| 522 |
-
if ( ! empty( $fields['categories'] )
|
| 523 |
// Set flag for possibly not loading globally.
|
| 524 |
$values = array_filter( array_values( $fields['categories'] ) );
|
| 525 |
if ( ! empty( $values ) ) {
|
| 526 |
$global = false;
|
| 527 |
}
|
| 528 |
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
|
|
|
|
|
|
|
|
|
| 568 |
}
|
| 569 |
|
| 570 |
// If the optin is only to be shown on particular taxonomies, get the code and break.
|
| 519 |
}
|
| 520 |
|
| 521 |
// If the optin is only to be shown on particular categories, get the code and break.
|
| 522 |
+
if ( ! empty( $fields['categories'] ) ) {
|
| 523 |
// Set flag for possibly not loading globally.
|
| 524 |
$values = array_filter( array_values( $fields['categories'] ) );
|
| 525 |
if ( ! empty( $values ) ) {
|
| 526 |
$global = false;
|
| 527 |
}
|
| 528 |
|
| 529 |
+
// Only load for the main "post" post type.
|
| 530 |
+
if ( 'post' == get_post_type() ) {
|
| 531 |
+
// Don't try to load on the blog home page even if a category that is selected appears in the loop.
|
| 532 |
+
if ( is_home() ) {
|
| 533 |
+
// Run a check for archive-type pages.
|
| 534 |
+
if ( ! empty( $fields['show'] ) ) {
|
| 535 |
+
// If showing on index pages and we are on an index page, show the optin.
|
| 536 |
+
if ( in_array( 'index', (array) $fields['show'] ) ) {
|
| 537 |
+
if ( is_front_page() || is_home() || is_search() ) {
|
| 538 |
+
$init[ $optin->post_name ] = $html;
|
| 539 |
+
$this->set_slug( $optin );
|
| 540 |
+
continue;
|
| 541 |
+
}
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
// Check if we should show on the 'post' post type.
|
| 545 |
+
if ( in_array( 'post', (array) $fields['show'] ) && ! ( is_front_page() || is_home() || is_search() ) ) {
|
| 546 |
+
$init[ $optin->post_name ] = $html;
|
| 547 |
+
$this->set_slug( $optin );
|
| 548 |
+
continue;
|
| 549 |
+
}
|
| 550 |
+
}
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
$categories = wp_get_object_terms( $post_id, 'category', array( 'fields' => 'ids' ) );
|
| 554 |
+
|
| 555 |
+
// Check againts singular.
|
| 556 |
+
foreach ( (array) $categories as $category_id ) {
|
| 557 |
+
if ( $category_id && in_array( $category_id, $fields['categories'] ) ) {
|
| 558 |
+
$init[ $optin->post_name ] = $html;
|
| 559 |
+
$this->set_slug( $optin );
|
| 560 |
+
continue 2;
|
| 561 |
+
}
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
// Check archives.
|
| 565 |
+
if ( is_category( $fields['categories'] ) ) {
|
| 566 |
+
$init[ $optin->post_name ] = $html;
|
| 567 |
+
$this->set_slug( $optin );
|
| 568 |
+
continue;
|
| 569 |
+
}
|
| 570 |
+
}
|
| 571 |
}
|
| 572 |
|
| 573 |
// If the optin is only to be shown on particular taxonomies, get the code and break.
|
optin-monster-wp-api.php
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
* Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster forms.
|
| 6 |
* Author: Thomas Griffin
|
| 7 |
* Author URI: https://thomasgriffin.io
|
| 8 |
-
* Version: 1.1.5.
|
| 9 |
* Text Domain: optin-monster-api
|
| 10 |
* Domain Path: languages
|
| 11 |
*
|
|
@@ -60,7 +60,7 @@ class OMAPI {
|
|
| 60 |
*
|
| 61 |
* @var string
|
| 62 |
*/
|
| 63 |
-
public $version = '1.1.5.
|
| 64 |
|
| 65 |
/**
|
| 66 |
* The name of the plugin.
|
| 5 |
* Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster forms.
|
| 6 |
* Author: Thomas Griffin
|
| 7 |
* Author URI: https://thomasgriffin.io
|
| 8 |
+
* Version: 1.1.5.2
|
| 9 |
* Text Domain: optin-monster-api
|
| 10 |
* Domain Path: languages
|
| 11 |
*
|
| 60 |
*
|
| 61 |
* @var string
|
| 62 |
*/
|
| 63 |
+
public $version = '1.1.5.2';
|
| 64 |
|
| 65 |
/**
|
| 66 |
* The name of the plugin.
|
readme.txt
CHANGED
|
@@ -151,6 +151,9 @@ OptinMonster is the <a href="http://optinmonster.com" rel="friend" title="OptinM
|
|
| 151 |
|
| 152 |
== Changelog ==
|
| 153 |
|
|
|
|
|
|
|
|
|
|
| 154 |
= 1.1.5.1 =
|
| 155 |
* Improved welcome screen for new installs.
|
| 156 |
* Bug fixes and enhancements.
|
| 151 |
|
| 152 |
== Changelog ==
|
| 153 |
|
| 154 |
+
= 1.1.5.2 =
|
| 155 |
+
* Fixed bug with post category selections causing campaigns to load globally.
|
| 156 |
+
|
| 157 |
= 1.1.5.1 =
|
| 158 |
* Improved welcome screen for new installs.
|
| 159 |
* Bug fixes and enhancements.
|
