Divi Builder render html code on post type - wordpress

I'm creating a website and I meet an issue with Divi / CPT UI.
I create a post type name "tente". In order to build the page with Divi builder, I add in function.php this code :
function my_et_builder_post_types( $post_types ){
$post_types[] = 'tentes';
return $post_types;
}
add_filter('et_builder_post_types', 'my_et_builder_post_types');
This is working, because I can use Divi builder in post type.
But, when I use tab element, the builder render HTML code on my website.
See what I've done :
And what it give to me on website :
I look at the Divi doc. I don't found something interesting about it.
Some of you have an idea ?

I am assuming you are on the latest version of Divi if not you need to update. Divi now allows for custom post types to get access to the builder. If you updated then do the following:
Remove the code you added above
In my case, I use CPT UI and have a post type named Doctors as shown below
Just go to Divi --> Theme options --> Builder --> Post Type Integration and make sure you Custom post type shows as Enabled as shown below
Your code might work but it's better to use the built-in way now that it exists.
Now, for the HTML problem.
Make sure you are in text mode NOT visual mode as shown below
Add the required shortcode to create 3 tabs
[et_pb_tabs admin_label="Tabs" use_border_color="off" border_color="#ffffff" border_style="solid"] [et_pb_tab title="Description" tab_font_select="default" tab_line_height="2em" tab_line_height_tablet="2em" tab_line_height_phone="2em" body_font_select="default" body_line_height="2em" body_line_height_tablet="2em" body_line_height_phone="2em"]
This is title1
[/et_pb_tab][et_pb_tab title="Managment" tab_font_select="default" tab_line_height="2em" tab_line_height_tablet="2em" tab_line_height_phone="2em" body_font_select="default" body_line_height="2em" body_line_height_tablet="2em" body_line_height_phone="2em"]
This is title2.
[/et_pb_tab][et_pb_tab title="Photos" tab_font_select="default" tab_line_height="2em" tab_line_height_tablet="2em" tab_line_height_phone="2em" body_font_select="default" body_line_height="2em" body_line_height_tablet="2em" body_line_height_phone="2em"]
This is title3.
[/et_pb_tab] [/et_pb_tabs]
This gives the following result
Now look at the above code while you are still in TEXT MODE and add your HTML where it says This is title1, This is title2 and This is title3 to populate the tabs with what you need. Hope this helps

Related

how to customize post meta in wordpress?

currently my theme on WordPress is Neve , and my posts all over the blog shows the following meta info :
https://i.stack.imgur.com/ynu71.jpg
where :
1- post title
2- post author
3- post date
4- post category
i want to replace these post meta with similar to this:
https://i.stack.imgur.com/Xywa9.jpg
for this purpose i have created a child theme and then installed snippet plugin to add php code easily and deactivate it once it is not working . unfortunately i could not find the code that can do the required modifications on that post meta :
https://i.stack.imgur.com/uwCrS.jpg
can any one provide a full php code to modify all these changes in one time after pasting into snippet ? or if there is another way i can do it ?
You'll have to create a child theme (already done) where you can override the current blog post template, instead of using a snippet plugin. To do this, copy the blog post template file from your theme and add it to your child theme.
WordPress will now read your child theme template instead of your theme's template, and you can easily modify the DOM from there, and shape the layout/text however way you want. (You can use the theme editor built-in in WordPress to modify the new child theme file. No plugin required.)
This is the proper way to modify a post page without plugins, and you can easily grab thing such as a post date, author, etc. via WordPress' built-in function. Example of how to get the author name of a WordPress post in PHP.
As for, 'latest edition' date, I will lend you a snippet I wrote for a client as WordPress. This will return the date at which a post has been modified as long as it is different from the publishing date (tweaks are common right after publication so it's a tad pointless to show a "last edited date" as the same as the publication date).
function current_post_last_edited_date_formatted() {
if(get_the_modified_date() !== get_the_date()) {
return '<p class="last-edited"> Last edited <span class="data">'.current_post_last_edited_date().'</span></p>';
} else {
return '';
};
}
The function you see called in the condition are WordPress core functions. =)

How to use a file url from Advanced Custom Fields to overwrite post title link?

I am developing a custom post type for the client to be able to upload a pdf using the advanced custom field file type. The current theme is Avada and I am wondering how I can change the title link to be the file URL?
I have thought about creating a custom page template and disregarding the archive altogether. I am open to suggestions/ideas.
The ideal outcome is using the native archive layout but having the title link to the file URL (pdf) instead of to the post.
You may use the filter to modify the title. The below code is untested just giving you the idea. Also, Make sure to check if the custom field exist.
add_filter('the_title', 'my_custom_title_with_link');
function my_custom_title_with_link($title){
global $post;
//please do a check for the post type otherwise all the post title will be changed
$title = ".$title.";
return $title;
}

Test WordPress TinyMCE with Codeception

I am trying to add content in a WordPress post type with an acceptance test in Codeception.
I tried several things but I can not make to work.
For example. I would like to add content in a Post or Page or Product. The main content is the iframe with TinyMCE in WordPress.
The best solution I found until now is this but it is not working on WordPress :
$I->switchToIFrame('#content_ifr');
$I->executeJS('document.getElementById("tinymce").innerHTML = "<p>Test content</p>";');
Have you got any idea how to implement this?
If anyone need to add content in the tinymce editor in WordPress with Codeception the solution is this :
$I->click('#content-html');
$I->fillField('#content', 'Test Content');
With the 1st command we change the tinymce tab to html and with the 2nd one we can add the content we like inside.
Hope this helps!

creating wordpress custom php page

I'm trying my make my first theme for wordpress.
Is there any possibility to create custom php page to display custom content?
Pretty much adding to WordPress another copy of the likes of single.php, post.php or 404.php.
All I want just a page to display the custom content on it.
Every tutorial I found so far uses just creating new page within WordPress.
I want to avoid it and for custom page to be enabled straight after theme activation.
The Idea is to have something like my_custom_page.php and to be able link to it after.
Is there any way of doing it?
Thanks
here is the solution to what I was looking for
http://kovshenin.com/2014/static-templates/
To achieve custom page functionality you can use page template concept of wordpress. Creating a page template is extremely easy. Create any new file in your theme and start the file with a comment block like so:
<?php
/*
Template Name: My Awesome Custom Page
*/
<h1>Hello There</h1>
You need paste php code inside this template file. When you submit for then redirection action will be page with custom template page.
Referance :
https://premium.wpmudev.org/blog/creating-custom-page-templates-in-wordpress/
Video :
https://youtu.be/1ZdHI8HuboA

add custom field template to theme admin page

in WP admin how to add the custom field template plugin to a theme page?
it automatically shows in posts and pages but i want this in the theme page. the theme am using is from iwak "creations" portfolio page.
what files do i need to modify to add this?
It's very hard to say what you need to modify without being able to look at the code. Being a premium theme, we can't just download it and take a look.
Having said that, the theme may use the WordPress custom post type functionality. Search the code for a call to the register_post_type function. If it's used, you may be in luck. Either
add 'custom-fields' to the supports argument in that call, or
call add_post_type_support after the post type is registered. The $post_type parameter will be the first value passed to the register_post_type function, and the $supports parameter will be 'custom-fields'.
Daniel, are you using this Custom Post Type Plugin - http://wordpress.org/extend/plugins/custom-field-template/screenshots/? I've used it before, and the guy who created it is Japanese, so his personal page isn't very useful as far as support for english goes.
I had some trouble with this at first. But what I think you're trying to do is add the custom fields to your new pages you've created, correct?
It's not very straightforward, but once it works it's pretty awesome.
Basically, when you set up the plugin you create these different "Custom fields," right? Well part of that should look like this:
[Custom Field Name]
type = textarea
rows = 4
cols = 40
tinyMCE = true
htmlEditor = true
Ok, so once you've created those "Custom fields" keep note of the part in brackets. You'll add this to your template pages:
<?php getCustomField('Custom Field Name'); ?>
Now when you enter the info in the pages or posts, the content should appear as you've entered it.

Resources