Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter MTWK-IDG

    (@mtwk-idg)

    The following code applies the new content to ALL open graph data. How do I just change the og:description

    function replace_meta_description($content,$property='og:description')
    {
    
    	$ai_yoast_description = get_post_meta( get_the_ID(),'_yoast_wpseo_metadesc' );
    	$yoast_description = $ai_yoast_description[0];
    	$content = $yoast_description;
    
    	return $content;
    }
    add_filter('open_graph_protocol_meta','replace_meta_description');

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    updating status of post

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    Thank you. Thank you. Thank you. I didn’t have to pull the if statement. The change in the array made all the difference. You made my month! I’ve been banging my head for weeks on this.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    Thanks for the response. I will try that.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    Okay. Still wrestling with this code. I’ve tested this code with serialized and non-serialized post meta.

    This code works perfectly fine with non-serialized meta. I go into Quick Edit, update the field and voila – the field is updated and displays correctly in the Admin List. So far so good.

    // BEGIN SAVE THE QUICK EDIT DATA   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    add_action( 'save_post','rachel_carden_save_post', 10, 2 );
    function rachel_carden_save_post( $post_id, $post ) {
    
       // don't save for autosave
       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
          return $post_id;
    
       // dont save for revisions
       if ( isset( $post->post_type ) && $post->post_type == 'revision' )
          return $post_id;
    
       switch( $post->post_type ) {
    
          case 'pattern':
    
             // release date
    	 // Because this action is run in several places, checking for the array key keeps WordPress from editing
             // data that wasn't in the form, i.e. if you had this post meta on your "Quick Edit" but didn't have it
             // on the "Edit Post" screen.
    	 if ( array_key_exists( 'pattern_company', $_POST ) )
    	    update_post_meta( $post_id, 'wpcf-own-pattern', $_POST[ 'pattern_company' ] );
    
    	 break;
    
       }
    
    }
    // END SAVE THE QUICK EDIT DATA   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    '
    
    Now I take that same EXACT code but attempt to use it with serialized data. I go into quick edit, update the item and voila - it now shows nothing in the targeted information - in this case, the id of the gravity form is now blank.
    '// BEGIN SAVE THE QUICK EDIT DATA   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    add_action( 'save_post','rachel_carden_save_post', 10, 2 );
    function rachel_carden_save_post( $post_id, $post ) {
    
       // don't save for autosave
       if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
          return $post_id;
    
       // dont save for revisions
       if ( isset( $post->post_type ) && $post->post_type == 'revision' )
          return $post_id;
    
       switch( $post->post_type ) {
    
          case 'product':
    
             // release date
    	 // Because this action is run in several places, checking for the array key keeps WordPress from editing
             // data that wasn't in the form, i.e. if you had this post meta on your "Quick Edit" but didn't have it
             // on the "Edit Post" screen.
    	 if ( array_key_exists( 'ai_gravityforms', $_POST ) )
    
    	 	$gravity_form_data = get_post_meta( $post_id,'_gravity_form_data');// grab the current serialized array in the database
    	 	$gravity_form_data[0]['id'] = '10'; // replace the id in the serialized array with some test data
    	 	 //$gravity_form_data[0]['id'] = '$_POST[ 'ai_gravityforms' ]; this is what I really want to grab
    		update_post_meta( $post_id, '_gravity_form_data', $gravity_form_data );
    	 break;
    
       }
    
    }
    // END SAVE THE QUICK EDIT DATA   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    When I test the following in the footer of page:
    $gravity_form_data = get_post_meta( get_the_ID(),’_gravity_form_data’);
    I can do a var_dump and see all the post meta for the particular product page that I’m on.
    I can also replace the id by
    $gravity_form_data[0][‘id’] = ’10’;
    This all works but not inside the above function.

    So the bottom line: How do I update serialized data when being processed via Quick Edit.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    THey say it’s beyond their support.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    If they pick from more than one, then the post(s) would have to be in all three terms.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    Site being used on:
    link

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    That works except that is_home() didn’t work. I’m using a static page for a home page. home is being added as the body class. But is_home() is not recognizing this as home page.
    Got around it by pointing to the page id.

    Thanks for your help.

    MTWK-IDG

    (@mtwk-idg)

    I’m having the same problem. Did you ever resolve this? I’m being told by hosting company that it’s a windows server issue.

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    “when you add a new page, no it does not automatically add it to the menu”
    That’s the problem. I need it to automatically add the page as I’m not going to be maintaining this site. The person who will needs to be able to add pages on the fly without worrying about having to update the menu also. Should I just use another theme?

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    I’ve never done custom menu’s before. Will it automatically add to the custom menu when I add a page?

    Thread Starter MTWK-IDG

    (@mtwk-idg)

    “have you set up your menu? Appearance>menus”

    Sorry I don’t understand the question. I’m just letting wordpress create the menu from the pages being created. Not sure why I would have to create a menu. I’ve never had to create a menu before. I’m not creating a custom menu here. This is just the basic navigation driven by wordpress. For some reason, it’s not taking the page name like it usually does and using it in the menu. I’ve never had this happen before. All my other pages are working fine. It’s just the home page that’s not cooperating. It’s named Home not Start but the menu doesn’t recognize that.

Viewing 13 replies - 1 through 13 (of 13 total)