If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #163244
    #163639

    Hello FarenAgency!

    I’m not sure if this is doable but I’ve tagged the head of support who should at least be able to shed a bit of light on it one way or another.

    Regards,
    Devin

    #163662

    I’ve used a work-around for the time being by adding a blanket Category (‘listings’) to the post type on creation and filtering to a single-listings.php file housing the dynamic template – outlined here: http://www.kriesi.at/support/topic/ (Purchase code hidden if logged out) -posts-in-category/.

    Had to add a filter hook in functions.php to route the category templates correctly (as I have been dealing with several similar post types), but it is working now.

    Still curious if there is a more proper way of doing this.

    Thanks.

    #163963

    Hi,
    Kriesi uses serialized data to store the post meta. You need to unserialize it to use it. I.e. replace your code

    
    $options = 'a:7:{s:6:"layout";s:25:"dynamic_template_listings";s:17:"dynamic_templates";s:8:"listings";s:27:"on_save_layout_dynamic_save";s:27:"on_save_layout_dynamic_save";s:15:"_slideshow_type";s:4:"fade";s:19:"_slideshow_position";s:3:"big";s:19:"_slideshow_autoplay";s:5:"false";s:19:"_slideshow_duration";s:1:"5";}';
    add_post_meta($id, "_avia_elements_avia_options_replete", $options);
    add_post_meta($id, "_avia_elements_theme_compatibility_mode", $options);
    

    with

    
    $options = 'a:7:{s:6:"layout";s:25:"dynamic_template_listings";s:17:"dynamic_templates";s:8:"listings";s:27:"on_save_layout_dynamic_save";s:27:"on_save_layout_dynamic_save";s:15:"_slideshow_type";s:4:"fade";s:19:"_slideshow_position";s:3:"big";s:19:"_slideshow_autoplay";s:5:"false";s:19:"_slideshow_duration";s:1:"5";}';
    $options = maybe_unserialize($options);
    add_post_meta($id, "_avia_elements_avia_options_replete", $options);
    add_post_meta($id, "_avia_elements_theme_compatibility_mode", $options);
    

    and it should work because it saves a proper array.

    #164080

    Awesome, thanks Dude. I will give that a shot.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Trouble applying Dynamic Templates with add_post_meta()’ is closed to new replies.