[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

oik_get_the_excerpt() – Implement "get_the_excerpt" for oik-shortcodes

You appear to be a bot. Output may be restricted

Description

Implements "get_the_excerpt" for oik-shortcodes

WordPress SEO ( Yoast SEO ) has a nasty habit of asking for the Excerpt if you don't set a Meta description. This can invoke a whole bunch of filters. We don't need this. While it's quite easy to type the Meta description when you hand create content, it may not be created for automatically generated stuff.

  • This filter will return an excerpt either from the excerpt or the part of the content before any <!–more comment
  • This allows for <!–more
  • It doesn't allow for <!–page or <!–noteaser
  • If there isn't a <!–more tag we return the full post content.
  • That can be dealt with by the subsequent filters.

Usage

$string = oik_get_the_excerpt( $excerpt, $post );

Parameters

$excerpt
( string|null ) optional – The current value for the excerpt.
$post
( object|null ) optional – The post from which the excerpt has been extracted.

Returns

string the excerpt we think will do

Source

File name: oik-shortcodes/oik-shortcodes.php
Lines:
1 to 17 of 17
function oik_get_the_excerpt( $excerpt=null, $post=null ) {
  if ( !$excerpt ) {
    if ( $post ) {
      if ( $post->post_excerpt ) {
        $excerpt = $post->post_excerpt;
      } else {
        $pos_more = strpos( $post->post_content, "<!--more" );
        if ( false !== $pos_more ) {
          $excerpt = substr( $post->post_content, 0, $pos_more );
        } else {
          $excerpt = $post->post_content;
        }
      }
    }
  }
  return $excerpt;
}
 
 View on GitHub

Published: March 11, 2017 | Last updated: March 11, 2017

Information

Function name: oik_get_the_excerpt
Plugin ref: oik block shortcode and API server
Version: 1.41.3
Sourcefile: oik-shortcodes.php
File ref: oik-shortcodes.php
API type: for
Deprecated?: No
API Letters: E,G,O,T

Recent plugin updates

sb-post-edit-block v0.3.2 Update to sb-post-edit-block v0.3.2 for support for PHP 8.1, 8.2 and 8.3 ...
oik-user v0.9.0 Update to oik-user v0.9.0 for support for PHP 8.1, PHP 8.2 and PHP 8.3  ...
oik-weight-zone-shipping v0.2.11 Update to oik-weight-zone-shipping v0.2.11 for WooCommerce High-Performance order storage compatibility ...
sb-breadcrumbs-block v0.6.1 Update to sb-breadcrumbs-block v0.6.1 for support for PHP 8.1 and PHP 8.2 ...
slog v1.5.1 Update to slog v1.5.1 for support for PHP 8.1 and PHP 8.2 ...

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: herb@bobbingwide.com

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2023. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.4.1. PHP: 7.4.33. Memory limit: 768M