Version Description
- Added: Meta tags directly added to this plugin as it is not allowed in a theme.
Download this release
Release Info
Developer | oceanwp |
Plugin | Ocean Extra |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.5.0 to 1.5.1
- ocean-extra.php +165 -2
- readme.txt +4 -1
ocean-extra.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Ocean Extra
|
4 |
* Plugin URI: https://oceanwp.org/extension/ocean-extra/
|
5 |
* Description: Add extra features like widgets, metaboxes, import/export and a panel to activate the premium extensions.
|
6 |
-
* Version: 1.5.
|
7 |
* Author: OceanWP
|
8 |
* Author URI: https://oceanwp.org/
|
9 |
* Requires at least: 4.5.0
|
@@ -86,7 +86,7 @@ final class Ocean_Extra {
|
|
86 |
$this->token = 'ocean-extra';
|
87 |
$this->plugin_url = plugin_dir_url( __FILE__ );
|
88 |
$this->plugin_path = plugin_dir_path( __FILE__ );
|
89 |
-
$this->version = '1.5.
|
90 |
|
91 |
define( 'OE_URL', $this->plugin_url );
|
92 |
define( 'OE_PATH', $this->plugin_path );
|
@@ -138,6 +138,9 @@ final class Ocean_Extra {
|
|
138 |
|
139 |
// Load custom widgets
|
140 |
add_action( 'widgets_init', array( $this, 'custom_widgets' ), 10 );
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
// Allow shortcodes in text widgets
|
@@ -390,6 +393,166 @@ final class Ocean_Extra {
|
|
390 |
|
391 |
}
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
/**
|
394 |
* Enqueue scripts
|
395 |
*
|
3 |
* Plugin Name: Ocean Extra
|
4 |
* Plugin URI: https://oceanwp.org/extension/ocean-extra/
|
5 |
* Description: Add extra features like widgets, metaboxes, import/export and a panel to activate the premium extensions.
|
6 |
+
* Version: 1.5.1
|
7 |
* Author: OceanWP
|
8 |
* Author URI: https://oceanwp.org/
|
9 |
* Requires at least: 4.5.0
|
86 |
$this->token = 'ocean-extra';
|
87 |
$this->plugin_url = plugin_dir_url( __FILE__ );
|
88 |
$this->plugin_path = plugin_dir_path( __FILE__ );
|
89 |
+
$this->version = '1.5.1';
|
90 |
|
91 |
define( 'OE_URL', $this->plugin_url );
|
92 |
define( 'OE_PATH', $this->plugin_path );
|
138 |
|
139 |
// Load custom widgets
|
140 |
add_action( 'widgets_init', array( $this, 'custom_widgets' ), 10 );
|
141 |
+
|
142 |
+
// Add meta tags
|
143 |
+
add_filter( 'wp_head', array( $this, 'meta_tags' ), 1 );
|
144 |
}
|
145 |
|
146 |
// Allow shortcodes in text widgets
|
393 |
|
394 |
}
|
395 |
|
396 |
+
/**
|
397 |
+
* Add meta tags
|
398 |
+
*
|
399 |
+
* @since 1.5.1
|
400 |
+
*/
|
401 |
+
public static function meta_tags() {
|
402 |
+
|
403 |
+
// Return if disabled or if Yoast SEO enabled as they have their own meta tags
|
404 |
+
if ( false == get_theme_mod( 'ocean_open_graph', false )
|
405 |
+
|| defined( 'WPSEO_VERSION' ) ) {
|
406 |
+
return;
|
407 |
+
}
|
408 |
+
|
409 |
+
// Facebook URL
|
410 |
+
$facebook_url = get_theme_mod( 'ocean_facebook_page_url' );
|
411 |
+
|
412 |
+
// Disable Jetpack's Open Graph tags
|
413 |
+
add_filter( 'jetpack_enable_opengraph', '__return_false', 99 );
|
414 |
+
add_filter( 'jetpack_enable_open_graph', '__return_false', 99 );
|
415 |
+
add_filter( 'jetpack_disable_twitter_cards', '__return_true', 99 );
|
416 |
+
|
417 |
+
// Type
|
418 |
+
if ( is_front_page() || is_home() ) {
|
419 |
+
$type = 'website';
|
420 |
+
} else if ( is_singular() ) {
|
421 |
+
$type = 'article';
|
422 |
+
} else {
|
423 |
+
// We use "object" for archives etc. as article doesn't apply there.
|
424 |
+
$type = 'object';
|
425 |
+
}
|
426 |
+
|
427 |
+
// Title
|
428 |
+
if ( is_singular() ) {
|
429 |
+
$title = get_the_title();
|
430 |
+
} else {
|
431 |
+
$title = oceanwp_title();
|
432 |
+
}
|
433 |
+
|
434 |
+
// Description
|
435 |
+
if ( is_category() || is_tag() || is_tax() ) {
|
436 |
+
$description = strip_shortcodes( wp_strip_all_tags( term_description() ) );
|
437 |
+
} else {
|
438 |
+
$description = html_entity_decode( htmlspecialchars_decode( oceanwp_excerpt( 40 ) ) );
|
439 |
+
}
|
440 |
+
|
441 |
+
// Image
|
442 |
+
$image = '';
|
443 |
+
$has_img = false;
|
444 |
+
if ( OCEANWP_WOOCOMMERCE_ACTIVE
|
445 |
+
&& is_product_category() ) {
|
446 |
+
global $wp_query;
|
447 |
+
$cat = $wp_query->get_queried_object();
|
448 |
+
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
|
449 |
+
$get_image = wp_get_attachment_url( $thumbnail_id );
|
450 |
+
if ( $get_image ) {
|
451 |
+
$image = $get_image;
|
452 |
+
$has_img = true;
|
453 |
+
}
|
454 |
+
} else {
|
455 |
+
$get_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
|
456 |
+
$image = $get_image[0];
|
457 |
+
$has_img = true;
|
458 |
+
}
|
459 |
+
|
460 |
+
// Post author
|
461 |
+
if ( $facebook_url ) {
|
462 |
+
$author = $facebook_url;
|
463 |
+
}
|
464 |
+
|
465 |
+
// Facebook publisher URL
|
466 |
+
if ( ! empty( $facebook_url ) ) {
|
467 |
+
$publisher = $facebook_url;
|
468 |
+
}
|
469 |
+
|
470 |
+
// Facebook APP ID
|
471 |
+
$facebook_appid = get_theme_mod( 'ocean_facebook_appid' );
|
472 |
+
if ( ! empty( $facebook_appid ) ) {
|
473 |
+
$fb_app_id = $facebook_appid;
|
474 |
+
}
|
475 |
+
|
476 |
+
// Twiiter handle
|
477 |
+
$twitter_handle = '@' . str_replace( '@' , '' , get_theme_mod( 'ocean_twitter_handle' ) );
|
478 |
+
|
479 |
+
// Output
|
480 |
+
$output = self::opengraph_tag( 'property', 'og:type', trim( $type ) );
|
481 |
+
$output .= self::opengraph_tag( 'property', 'og:title', trim( $title ) );
|
482 |
+
|
483 |
+
if ( isset( $description ) && ! empty( $description ) ) {
|
484 |
+
$output .= self::opengraph_tag( 'property', 'og:description', trim( $description ) );
|
485 |
+
}
|
486 |
+
|
487 |
+
if ( has_post_thumbnail( oceanwp_post_id() ) && true == $has_img ) {
|
488 |
+
$output .= self::opengraph_tag( 'property', 'og:image', trim( $image ) );
|
489 |
+
$output .= self::opengraph_tag( 'property', 'og:image:width', absint( $get_image[1] ) );
|
490 |
+
$output .= self::opengraph_tag( 'property', 'og:image:height', absint( $get_image[2] ) );
|
491 |
+
}
|
492 |
+
|
493 |
+
$output .= self::opengraph_tag( 'property', 'og:url', trim( get_permalink() ) );
|
494 |
+
$output .= self::opengraph_tag( 'property', 'og:site_name', trim( get_bloginfo( 'name' ) ) );
|
495 |
+
|
496 |
+
if ( is_singular() && ! is_front_page() ) {
|
497 |
+
|
498 |
+
if ( isset( $author ) && ! empty( $author ) ) {
|
499 |
+
$output .= self::opengraph_tag( 'property', 'article:author', trim( $author ) );
|
500 |
+
}
|
501 |
+
|
502 |
+
if ( is_singular( 'post' ) ) {
|
503 |
+
$output .= self::opengraph_tag( 'property', 'article:published_time', trim( get_post_time( 'c' ) ) );
|
504 |
+
$output .= self::opengraph_tag( 'property', 'article:modified_time', trim( get_post_modified_time( 'c' ) ) );
|
505 |
+
$output .= self::opengraph_tag( 'property', 'og:updated_time', trim( get_post_modified_time( 'c' ) ) );
|
506 |
+
}
|
507 |
+
|
508 |
+
}
|
509 |
+
|
510 |
+
if ( is_singular() ) {
|
511 |
+
|
512 |
+
$tags = get_the_tags();
|
513 |
+
if ( ! is_wp_error( $tags ) && ( is_array( $tags ) && $tags !== array() ) ) {
|
514 |
+
foreach ( $tags as $tag ) {
|
515 |
+
$output .= self::opengraph_tag( 'property', 'article:tag', trim( $tag->name ) );
|
516 |
+
}
|
517 |
+
}
|
518 |
+
|
519 |
+
$terms = get_the_category();
|
520 |
+
if ( ! is_wp_error( $terms ) && ( is_array( $terms ) && $terms !== array() ) ) {
|
521 |
+
// We can only show one section here, so we take the first one.
|
522 |
+
$output .= self::opengraph_tag( 'property', 'article:section', trim( $terms[0]->name ) );
|
523 |
+
}
|
524 |
+
|
525 |
+
}
|
526 |
+
|
527 |
+
if ( isset( $publisher ) && ! empty( $publisher ) ) {
|
528 |
+
$output .= self::opengraph_tag( 'property', 'article:publisher', trim( $publisher ) );
|
529 |
+
}
|
530 |
+
|
531 |
+
if ( isset( $fb_app_id ) && ! empty( $fb_app_id ) ) {
|
532 |
+
$output .= self::opengraph_tag( 'property', 'fb:app_id', trim( $fb_app_id ) );
|
533 |
+
}
|
534 |
+
|
535 |
+
// Twitter
|
536 |
+
$output .= self::opengraph_tag( 'name', 'twitter:card', 'summary_large_image' );
|
537 |
+
$output .= self::opengraph_tag( 'name', 'twitter:title', trim( $title ) );
|
538 |
+
|
539 |
+
if ( isset( $description ) && ! empty( $description ) ) {
|
540 |
+
$output .= self::opengraph_tag( 'name', 'twitter:description', trim( $description ) );
|
541 |
+
}
|
542 |
+
|
543 |
+
if ( has_post_thumbnail( get_the_ID() ) && true == $has_img ) {
|
544 |
+
$output .= self::opengraph_tag( 'name', 'twitter:image', trim( $image ) );
|
545 |
+
}
|
546 |
+
|
547 |
+
if ( isset( $twitter_handle ) && ! empty( $twitter_handle ) ) {
|
548 |
+
$output .= self::opengraph_tag( 'name', 'twitter:site', trim( $twitter_handle ) );
|
549 |
+
$output .= self::opengraph_tag( 'name', 'twitter:creator', trim( $twitter_handle ) );
|
550 |
+
}
|
551 |
+
|
552 |
+
echo $output;
|
553 |
+
|
554 |
+
}
|
555 |
+
|
556 |
/**
|
557 |
* Enqueue scripts
|
558 |
*
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: oceanwp
|
|
3 |
Tags: widgets, meta box, metaboxes, metabox, oceanwp
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.0
|
6 |
-
Stable tag: 1.5.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -32,6 +32,9 @@ This plugin will only work with the [OceanWP](https://oceanwp.org/) theme.
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
35 |
= 1.5.0 =
|
36 |
- Added: Setup Wizard to help you to create very easily your website.
|
37 |
- Tweak: You can now select a post type for the [oceanwp_search] shortcode.
|
3 |
Tags: widgets, meta box, metaboxes, metabox, oceanwp
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.0
|
6 |
+
Stable tag: 1.5.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.5.1 =
|
36 |
+
- Added: Meta tags directly added to this plugin as it is not allowed in a theme.
|
37 |
+
|
38 |
= 1.5.0 =
|
39 |
- Added: Setup Wizard to help you to create very easily your website.
|
40 |
- Tweak: You can now select a post type for the [oceanwp_search] shortcode.
|