wp_link_pages: display current page number only if has multiple page breaks?

The $multipage is constructed inside the setup_postdata() method of WP_Query. It’s called when you run the_post(). So just as @s_ha_dum explained, you have to make a loop around it: You can try this: if( have_posts() ) { the_post(); // Make a call to setup_postdata(). echo sbwp_get_current_chapter(); // Display the current chapter. rewind_posts(); // Rewind back. … Read more

A snippet after every image

Try get_image_tag filter: add_filter(‘get_image_tag’, function($html, $id, $alt, $title, $align, $size) { return $html . ‘<div>some piece of code here</div>’; }, 10, 6); References: get_image_tag() get_image_send_to_editor() wp_ajax_send_attachment_to_editor()

How do I call wp_mail from HTML?

First the way to do this is with a form using the post method, it is slightly easier to understand: <!– form with AJAX action and iframe target –> <form method=”post” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” target=”emailsendframe”> <!– AJAX action field to trigger function–> <input type=”hidden” name=”action” value=”download_email_send”> <!– Post ID field –> <input type=”hidden” name=”intro” … Read more

Dequeue script in template isn’t working

Move your project_dequeue_unnecessary_scripts() function to your functions.php file and add a conditional statement to determine if the appropriate template is being loaded. E.g.: // Remove Mobile Header function project_dequeue_unnecessary_scripts() { if ( is_page_template( ‘name-of-template.php’ ) ) { wp_dequeue_script( ‘enterprise-responsive-menu’ ); wp_deregister_script( ‘enterprise-responsive-menu’ ); } } add_action( ‘wp_print_scripts’, ‘project_dequeue_unnecessary_scripts’ ); I suspect that your function is … Read more

Hide WYSIWYG editor on certain templates

I hope I understood your question right. The following code will remove the editor from the pages using particular templates: <?php function wpse242371_remove_editor_from_some_pages() { global $post; if( ! is_a($post, ‘WP_Post’) ) { return; } /* basename is used for templates that are in the subdirectory of the theme */ $current_page_template_slug = basename( get_page_template_slug($post_id) ); /* … Read more

Functions.php reverted to new one

You should not change anything in files inside wp-admin and wp-includes folder. All these files gets overwritten when WordPress is updated. The correct functions.php file is in your theme folder. full path to that file: wp-content/themes/YOUR-THEME-FOLDER/functions.php

Replace Archive Widget Link Text

You can use regular expression and the preg_replace_callback() function: function _make_khmer_link_replace_callback( array $matches ) { return ‘<a’ . $matches[1] . ‘>’ . convert_numbers_to_khmer( $matches[2] ) . ‘</a>’; } function make_khmer_link( $link ) { if ( get_bloginfo( ‘language’ ) == ‘km’ ) { $link = preg_replace_callback( ‘#<a(.*?)>(.+?)</a>#’, ‘_make_khmer_link_replace_callback’, $link ); } return $link; } add_filter(‘get_archives_link’, ‘make_khmer_link’); … Read more

Customize “the_posts_pagination” and put list instead div

Making your Custom Pagination design In Demo According Your Need . below function Replace Your Function: function wp_custom_pagination($args = [], $class=”pagination”) { if ($GLOBALS[‘wp_query’]->max_num_pages <= 1) return; $args = wp_parse_args( $args, [ ‘mid_size’ => 2, ‘prev_next’ => false, ‘prev_text’ => __(‘Previous’, ‘textdomain’), ‘next_text’ => __(‘Next’, ‘textdomain’), ‘screen_reader_text’ => __(‘Posts navigation’, ‘textdomain’), ]); $links = paginate_links($args); … Read more