My custom get_the_excerpt() can’t get excerpt by ID

Try this one /* Change Excerpt length */ function excerpt($num, $post_id) { // removed empty default value $limit = $num+1; $excerpt = apply_filters(‘the_excerpt’, get_post_field(‘post_excerpt’, $post_id)); $excerpt = explode(‘ ‘, $excerpt, $limit); array_pop($excerpt); $excerpt = implode(” “,$excerpt).”&#8230”; echo $excerpt; } Another solution – using setup_postdata($post); and wp_reset_postdata(); function custom_get_the_excerpt($post_id) { global $post; $save_post = $post; $post … Read more

Archives shortcode displaying above widget title

Either use output buffering: // Email Archives Shortcode function email_archives_shortcode() { ob_start(); ?> <select name=”archive-dropdown” onchange=”document.location.href=this.options[this.selectedIndex].value;”> <option value=””><?php echo esc_attr( __( ‘Select Month’ ) ); ?></option> <?php wp_get_archives( array( ‘type’ => ‘monthly’, ‘format’ => ‘option’, ‘show_post_count’ => 1, ‘post_type’ => ’emails’ ) ); ?> </select> <?php return ob_get_clean(); } add_shortcode(’email-archives’, ’email_archives_shortcode’); Or a string function … Read more

How can I modify footer when footer.php calls to another file?

You can remove_action and add_action with your own action. (https://codex.wordpress.org/Function_Reference/remove_action) In your child theme functions.php you can add this code for example : add_action(‘init’, ‘remove_talon_footer’); // Remove your parent theme actions function remove_talon_footer() { remove_action(‘talon_footer’, ‘talon_footer_sidebar’, 7); // Use same priority remove_action(‘talon_footer’, ‘talon_footer_credits’, 8); remove_action(‘talon_footer’, ‘talon_footer_menu’, 9); } /** * Footer sidebar */ function my_talon_footer_menu() … Read more

How to change menu labels

In order to change the menu labels you will have to go to add this code into your functions.php: add_filter( ‘gettext’, ‘change_woocommerce_text’ ); function change_woocommerce_text( $translated ) { $translated = str_replace( ‘WooCommerce’, ‘Store’, $translated ); return $translated; } Tested.

How to know where this function definition is declared?

To answer your other question, about the two types of passwords stored in the database: Up until version 2.5, WordPress stored passwords encrypted with the MD5 hashing algorhythm. MD5 is nowadays considered to be poor security – with moderately-priced off-the-shelf GPUs, it takes less than a hour for a program to brute-force all possible combinations … Read more

How to access variables from Functions file in theme files

Whilsts @Shaon’s answer is perfectly valid, I’m of the opinion you really shouldn’t be throwing configuration settings around as global variables – use a constant instead. /* Constants are in the global scope, but can only be defined once. */ define( ‘FEEDBURNER_USERNAME’, ‘my_username’ ); define( ‘FEEDBURNER_PASSWORD’, ‘my_password’ ); If the variable needs to be dynamic … Read more

How do I find PHP file that contains content of my page?

You are under a fundamentally wrong assumption: The content you input via the administrative back-end does not live in a file, but in the database, specifically in the wp_posts table. Do not be misguided by the table’s name, a “page” is technically a post of type page. If you attempted to find the content you … Read more

Form Security: nonce vs. jQuery

jQuery is a js library not a transport protocol, your data is sent via GET or POST, wether you use jquery or not. Think of it like this, sometimes it’s the user in the first frame, sometimes it’s javascript: Firstly nonces are not the same as sanitisation, they have different purposes Sanitisation is about verifying … Read more