PHP code example of keesiemeijer / additional-content

1. Go to this page and download the library: Download keesiemeijer/additional-content library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

keesiemeijer / additional-content example snippets


add_filter( 'additional_content_metabox_text', 'change_additional_content_text_strings' );

function change_additional_content_text_strings( $text ) {

	$text['title']                  = __( 'Add Shortcodes', 'additional-content' );
	$text['content']                = __( 'Shortcode', 'additional-content' );
	$text['prepend_content']        = __( 'Prepend Shortcode', 'additional-content' );
	$text['append_content']         = __( 'Append Shortcode', 'additional-content' );
	$text['prepend_append_content'] = __( 'Prepend and Append Shortcode', 'additional-content' );
	$text['prepend']                = __( 'Prepend shortcode', 'additional-content' );
	$text['append']                 = __( 'Append shortcode', 'additional-content' );
	$text['priority']               = __( 'Priority', 'additional-content' );
	$text['add_row']                = __( 'Add shortcode', 'additional-content' );
	$text['add_more_row']           = __( 'Add more shortcodes', 'additional-content' );
	$text['remove_row']             = __( 'Remove', 'additional-content' );
	$text['header_info']            = __( 'Add shortcodes to the post content on single post pages. ', 'additional-content' );
	$text['priority_info']          = '';

	return $text;
}

add_filter( 'additional_content_metabox_options', 'remove_additional_content_options' );

function remove_additional_content_options( $options ) {
	$options['append_prepend'] = false;
	$options['priority'] = false;

	return $options;
}

add_filter( 'the_content', 'additional_content_home_page' );

function additional_content_home_page( $content ) {

	// Check if we're on the home page
	if ( !is_home() ) {
		return $content;
	}

	// Check if this is the main query and inside the loop.
	if ( in_the_loop() && is_main_query() ) {

		// Check if the plugin function get_content() exists.
		if ( function_exists( 'keesiemeijer\Additional_Content\\get_content' ) ) {
			// Add the additional content to the post content with the get_content() function.

			// Content and post id are