inc2734 / wp-contents-outline
A library for WordPress. This adds contents outline of the post.
Installs: 7 090
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 3
Language:JavaScript
Requires
- php: >=7.4
- inc2734/wp-plugin-view-controller: ^1.1
Requires (Dev)
- dev-master
- 5.3.2
- 5.3.1
- 5.3.0
- 5.2.1
- 5.2.0
- 5.1.6
- 5.1.5
- 5.1.4
- 5.1.3
- 5.1.2
- 5.1.1
- 5.1.0
- 5.0.2
- 5.0.1
- 5.0.0
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.1
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-dependabot/npm_and_yarn/sideway/formula-3.0.1
- dev-dependabot/npm_and_yarn/http-cache-semantics-4.1.1
- dev-dependabot/npm_and_yarn/json5-1.0.2
This package is auto-updated.
Last update: 2024-11-05 07:51:11 UTC
README
Install
$ composer require inc2734/wp-contents-outline
How to use
<?php
new \Inc2734\WP_Contents_Outline\Bootstrap();
// Set shortcode in post
// e.g. You want to contents outline from `$('.c-entry__content').children('h2, h3, h4, h5, h6')`
[wp_contents_outline title="(Optional)" post_id="(Optional)" selector=".c-entry__content" move_to_before_1st_heading="true"]
Filter hooks
inc2734_wp_contents_outline_enqueue_js
/**
* If you don't need js enqueue, you can cancel enqueue.
*/
add_filter( 'inc2734_wp_contents_outline_enqueue_js', '__return_false' );
inc2734_wp_contents_outline_args
/**
* Customize args.
*
* @param array $attributes
* @return array
*/
add_filter(
'inc2734_wp_contents_outline_args',
function( $attributes ) {
return $attributes;
}
);
inc2734_wp_contents_outline_view_args
/**
* @param array $args
* @var string $slug
* @var string $name
* @var array $vars
* @param array
*/
add_filter(
'inc2734_wp_contents_outline_view_args',
function( $args ) {
return $args;
}
);
inc2734_wp_contents_outline_view_render
/**
* @param string $html
* @param string $slug
* @param string $name
* @param array $vars
* @return string
*/
add_filter(
'inc2734_wp_contents_outline_view_render',
function( $html, $slug, $name, $vars ) {
return $html;
},
10,
4
);
Action hooks
/**
* Add HTML before .wpco
*
* @param array $attributes
* @return array
*/
add_action(
'inc2734_wp_contents_outline_before',
function( $attributes ) {
?>
HTML
<?php
}
);
inc2734_wp_contents_outline_view_pre_render
/**
* @param array $args
* @var string $slug
* @var string $name
* @var array $vars
*/
add_action(
'inc2734_wp_contents_outline_view_pre_render',
function( $args ) {
}
);
inc2734_wp_contents_outline_view_post_render
/**
* @param array $args
* @var string $slug
* @var string $name
* @var array $vars
*/
add_action(
'inc2734_wp_contents_outline_view_post_render',
function( $args ) {
}
);
inc2734_wp_contents_outline_view_<slug>
/**
* @param string $name
* @param array $vars
*/
add_action(
'inc2734_wp_contents_outline_view_<slug>',
function( $name, $vars ) {
?>
HTML
<?php
},
10,
2
);
inc2734_wp_contents_outline_view_<slug>-<name>
/**
* @param array $vars
*/
add_action(
'inc2734_wp_contents_outline_view_<slug>-<name>',
function( $vars ) {
?>
HTML
<?php
}
);