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!
Related
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
I've been stuck on this for a while. I'm working on a wordpress site.
I'm trying to use a Advanced post slider plugin, but calling it in a template via
echo do_shortcode('[advps-slideshow optset="1"]'); //just isn't working.
But it is working when directly pasted [advps-slideshow optset="1"] in wordpress page.
Any help would be greatly appreciated.
Advanced post slider looks to be working my end with the code you provided. What happens if you do <?php print_r(do_shortcode('[advps-slideshow optset="1"]')); ?> are you also getting any js errors in your console log?
the problem seems to be in the plugin itself, as I see no errors in the string you wrote. I think you should write the developers with this issue. you may suggest you another slider plugin with shortcodes for WP post galleries- freemake slider. on you blog it works well. the archive can be loaded from here http://www.freemake.com/free_wordpress_slider_plugin/
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
I'm using the theme of Omega 3. I would like to review the layout of certain fields inside my content type "video". I made so the file: node--video.tpl.php:
<? php print render ($ content ['body']); ?>
yet even this simple statement does not work. Does anyone know the reason? No review of the design of the node with omega 3?
for better debugging, try to install devel module and theme developer module.
Both can be your best friends till you solve this issue.
Hope this helps... Muhammad.
I understand why it did not work. Going up: structure -> content type -> manage display, the fields that I want to print with php hidden. Putting them visible both on the "teaser" that the "default" everything works as it should.
I am using WordPress 3.2.1 ,
Page template selection drop down is missing on Pages (Add,Edit)
wp-admin > Pages >Add New > Page Attributes
I Edit the Template Page Default page as below code
/*
Template Name: New Template
*/
But still the template drop down no visible , my older version of WordPress it display by default.
Following is the screen shot for more idea
I solved this problem solved by adding the typical following code:
/*
Template Name: Custom
*/
Don't add any spaces after Name:
It'll work if you use template name: as well.
It might help someone: check if your index.php file is in place.
If it's not there, wordpress treats the template as corrupt and it doesn't display the template selection.
This should be simple to troubleshoot. The requirements for the page template to work are straight forward:
The template needs the page title in the top of the file like you've shown (the title needs to be wrapped in a PHP tag, you probably just didn't add it with your example bu I want to make sure you havne't overlooked it):
<?php
/*
Template Name: Custom
*/
?>
The second requirement is that the file is in the root of the theme folder.
With those two requirements in place, it should work. If it isn't working you nave a few possible issues. I list a few off the top of my head:
You might need to re-install WordPress in-case a file was corrupted
during your last update.
It's possible someone has altered the WP-Admin layout using users
roles.
That's all I can thing of at the moment, let me know how it turns out.
I had the same issue. It actually turned out to be a missing style.css file within the template directory in my case.
This happens because the get_post_templates() in class-wp-theme.php first checks for errors. If it finds any then it returns an empty array (no templates are displayed).
A side effect of this is that saving a page would clear the existing template and use the page.php instead.
So in short if the errors() method of your theme returns any errors then no templates dropdown.
hope that helps someone.
Same issued, I found out that in appearance panel in your WordPress dashboard the stylesheet is missing. You shouldn't rename the style.css in your theme folder.
Not sure if this will help anyone, but we solved the problem by disabling our theme and re-enabling it again. We had some other theme folders in the theme directory that we weren't using so we deleted those out as well. good luck, it's a really random problem to solve!
yeah!template dropdown not showing because you have no template So how to solve this::---
1 create template folder in theme
2 create a template in this folder
like:-
<?php /* Template Name: Home */ echo "template"; ?>
and check-in page dropdown will be there.