Page mobile content

Posted in: Newspaper
Post count: 28

Hello! When i create a page via rest api, the mobile version does not show the content and i have to manually insert the content in mobile editor. Could you tell me please how I could solve this problem and fill this field via rest api?

Post count: 27744

Hi,

The mobile theme comes with its own templates for page, post, category, etc so your current templates from the desktop theme will get converted to the mobile theme layout, the page content is made without builders in mobile editor => https://www.screencast.com/t/xbgZG8kH also, the options that are provided to edit the mobile theme version are limited (this keeps the things simple)).
So, if you want to use the cloud templates, then you need to disable the mobile theme and AMP plugins, and then use the responsive version.
You can disable the mobile theme plugin on the pages from the Gutenberg editor using the following option => https://www.screencast.com/t/axXRJsWby
Also, please check this topic where I explained each mobile version -> https://forum.tagdiv.com/topic/mobile-version-not-working-properly-2/ -> https://forum.tagdiv.com/topic/amp-pages-not-working-well-with-this-theme/ and choose what mobile version you want.

Thank you!

Post count: 28

Hi, i need mobile version so my question is how can i put content to this field https://www.screencast.com/t/xbgZG8kH via rest api? Thank you

Post count: 27744

Hello,

Unfortunately, you can’t create a page for mobile theme using rest API.

Thank you!

Post count: 28

You must have a pay per post system, every time on this forum you get a waste of time (premium) instead of help. Let’s go in a different way. If there is a field in the admin, it means that it was created there and it can be displayed in the rest api. In order for me to try to display it I need advice (not to waste a lot of time ….) how the developer has realized this field (for example, that it is a meta field with such and such name and that you can try to display it like this, or at least what is this field) so that I could at least look for help and try to do something. Thanks, I hope the answer will be more informative than the previous ones

Post count: 28

This field called td_wp_editor (meta field) and this is the function for exposing it to the REST API.
function expose_td_wp_editor_field() {
register_rest_field(‘page’, ‘td_wp_editor’, array(
‘get_callback’ => ‘get_td_wp_editor_value’,
‘update_callback’ => ‘update_td_wp_editor_value’,
‘schema’ => null,
));
}

function get_td_wp_editor_value($object, $field_name, $request) {
return get_post_meta($object[‘id’], $field_name, true);
}

function update_td_wp_editor_value($value, $object, $field_name) {
if (!empty($value) && is_string($value)) {
return update_post_meta($object->ID, $field_name, wp_kses_post($value));
} else {
return delete_post_meta($object->ID, $field_name);
}
}

add_action(‘rest_api_init’, ‘expose_td_wp_editor_field’);

I really look forward to when you will be replaced by chat bots, they at least answer quickly and to the question asked. Regards!

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.