Retrieve post modified date for specific post by post ID

Place this code snippet put in function.php, this should give you what you need. function my_theme_wp_title( $title, $sep ) { global $post; /* my other title cases */ //get post’s modified date $m_date = get_the_modified_date(); //concatenate the current title with the date string, using the separator to be more clear $title .= $sep . ” … Read more

creating shortcode to pull json array

As per documentation on wp_remote_get() it doesn’t return you just the body of requested resource. Its return will be either the array of data or WP_Error object on failure. The simplest snippet to get to the body would be: $json = wp_remote_retrieve_body( wp_remote_get( $url ) ); PS it’s kinda weird to be doing this in … Read more

Change WP attachment name to postid during upload only for post type

I’m really sorry. I fixed my problem after few minutes I post this question. So I added my working code here for future help if anyone need this. add_action(‘add_attachment’, ‘rename_attacment’); function rename_attacment($post_ID){ if ( get_post_type( $_REQUEST[‘post_id’] ) === ‘post_type_1’ OR get_post_type( $_REQUEST[‘post_id’] ) === ‘post_type_2’ OR get_post_type( $_REQUEST[‘post_id’] ) === ‘post_type_3’ ){ $post = get_post($post_ID); … Read more

how to change link of some wordpress pages

Create a blank page and name it panel then go to your created signup template and select parent page panel. Its just below Publish->Page Attributes. /*Add noindex to this page (Add to functions.php)*/ function add_noindex_tags(){ # Add noindex to page. if( is_page(‘panel’) ) echo ‘<meta name=”robots” content=”noindex,nofollow”>’; } add_action(‘wp_head’,’add_noindex_tags’, 4 );

How to use IF Statement in WordPress?

Here you go.. add_action( ‘gform_after_update_entry_7’, ‘add_length_on_update’, 10, 2 ); function add_length_on_update( $form, $entry_id ) { if( !empty($_POST[“input_3”]) && !empty($_POST[“input_27”]) && !empty($_POST[“input_28”]) ){ // get input from form $date = $_POST[“input_3”]; $start = $_POST[“input_27”]; $end = $_POST[“input_28”]; // convert date and time arrays into datetime formats $startdate = DateTime::createFromFormat(‘m/d/Y@h:i a’, $date . “@”. $start[0].”:”.$start[1].” “.$start[2]); $enddate … Read more

wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go

I enqueued the child script the right way and made the first Reference Error (eltdGlobalVars) disappear as follows: In functions.php in child I removed lines that dequeue the script “search_and_go_elated_listing”. Then I enqueued it using a copy of the function with the same name as the pluggable function in parent: “search_and_go_elated_listing_assets”. Within this copy I … Read more