Option Tree not passing WordPress Theme Check - php

I am having a problem uploading my theme to wordpress.org. The initial theme check fails with the below error..
REQUIRED: ot-settings-api.php. Themes should use add_theme_page() for adding admin pages.
Line 99: $theme_check_bs = 'add_menu_page';
REQUIRED: ot-settings-api.php. Themes should use add_theme_page() for adding admin pages.
Line 100: $theme_check_bs2 = 'add_submenu_page';
REQUIRED: ot-cleanup-api.php. Themes should use add_theme_page() for adding admin pages.
Line 82: $theme_check_bs = 'add_menu_page';
I have integrated Option Tree framework into my team. But WordPres.org doesn't accept until the issue is resolved.. The funny thing is i downloaded few other themes from WordPress directory which uses Option Tree, I tested with the Theme Check Plugin and they all didn't pass, so how did they manage to upload their themes to the wordpress.org theme directory? How do i resolve the REQUIRED issue and upload my theme successfully..

Related

How to manually create a text-domain for a WordPress child theme?

I don't know how to manually add a text-domain to my child theme.
I installed LocoTranslate to find out what the text-domain was, and it shows the same as the main theme.
This is a problem, but I need to add a file that has been made custom and it must call this child theme in various parts of the code, now it calls the main theme and this is the problem.
Searching I found [WordPress documentation on child themes,][1] but I must say that I don't know how to interpret it, my experience is not enough to know how to read this documentation.
I don't even keep looking and I can't find a site that describes how to do this by someone inexperienced.
Is there a document outlining the steps to create a child theme text-domain for beginners?
Go into the style.css file in your child theme. In the comment header, add a text domain field under the theme name field.
/*
Theme Name: My Child Theme
Text Domain: mychildtheme
*/
Then, go to your functions.php file in your child theme and add the following code.
function mychildtheme_load_textdomain() {
load_child_theme_textdomain( 'mychildtheme', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'mychildtheme_load_textdomain' );
Change 'mychildtheme' to the text domain you gave in your style.css file.

How to add(include) elementor created page in theme file 404.php

I created a page using elementor(named as: 'Error-page'), currently using linoor theme. What I want is to load this 'Error-page' via theme's default 404.php file (NOT using any plugin). Should I just type in 'include Error-page.php' in 404.php file to make it work?
Meta: My goal is to show my custom error page which I created using elementor(named as: Error-page) when invalid url is typed. One way of doing it is using plugin(I prefer not to do this for the time being), 2nd way could be somehow including this custom page in theme's default 404.php file
Note: Im new to wordpress
after thinking about your question, i have 2 solutions for you:
1. if you do not have code knowledge
This way is simple and safer, but have limits than other way - it's not using your template but redirect viewer to your template page. Any way, the same result
Build the 404 template with Elementor and publish it
Open your theme's 404.php file
In the very first top of the template file **(below <?php tag) paste this code:
wp_redirect( '/your-template-slug' );
exit;
Save it and you're done
2. If you have basic code knowledge:
This way is a litle complex, but it alow you to using not for 404 file - but other templates (archive, categories...)
Install "Anywhere Elementor" plugin
Build the 404 template as you do with Elementor
Get your template php shortcode
Edit the theme's 404.php file to echo out your template
In case you need more detail guide, i have record a step by step guide video here

I want to change the title-line on an archive-page in Wordpress

An archive-page gives as title: Tag: <tag-title> or Category: <category-title>. That's nice, but I like to have only: <tag-title> or <category-title>.
As far as I can see, the standard title is constructed in ../wp-includes/general-templates.php while /wp-content/languages/nl_NL.mo translates the "Tag:" and "Category:" part into Dutch.
So I tried to reach my goal by translating Tag: %s into %s; that worked, till Wordpress Translations were updated. Translating the child theme's nl_NL.mo didn't work. So I guess this is not something in the theme, but i Wordpress.
I tried to change the code in /wp-includes/general-templates.php and that worked - till WordPress was updated. So what can I do to make the changes of the title-line on my archive-pages sustainable?
You would need to create and activate a child theme, find the php template file in the parent theme which is used for archive pages and which contains the title of the archive pages, copy that file to the child theme and change that copy it to your needs.
Typically, that page would use the archive.php file or the category.php file as a template, in less complex themes it could also just use the index.php file. Depending on the complexity of the parent theme, these files could also contain include functions which use additional template-part files - you'll have to find out yourself.

WordPress independent functions.php

I have a fresh WordPress and bbPress installed on an internal server.
While I was setting up bbPress I wanted to test the functionalities like creating a forum, topic, etc. When doing these stuff in the back-end (dashboard) there didn't seem to be any problems but when I did it from the front-end I kept getting
ERROR: Are you sure you wanted to do that?
I searched for a solution and found this.
add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
function my_bbp_verify_nonce_request_url( $requested_url )
{
return 'http://localhost:8888' . $_SERVER['REQUEST_URI'];
}
I simply changed the hard-coded URL to what our internal server is set up to and it fixed the problem.
Now my question: is it possible for me to add this solution to a functions.php that is independent of the theme being used? I asked this because I have 2 concerns:
The current theme might get updated and will overwrite the file
I'm aware that the solution to this is simply create a child theme but my second concern prevents me from doing this.
The WordPress administrator might change themes and so both the functions.php file on the main theme and the child theme will stop working
How could I add the solution above so that I don't have to worry about the theme being updated and/or replaced with a new theme in the future? I don't want to keep adding this solution every time the administrator decides to change themes.
If you can't put it in a theme, put it in a Plugin. If you're worried that the plugin will get de-activated make it a Must Use Plugin.
It's dead simple to create a plugin. Create a file plugin-name.php and place it in a directory wp-content/plugins/plugin-name/. That file should contain the following code:
<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
function my_bbp_verify_nonce_request_url( $requested_url )
{
return 'http://localhost:8888' . $_SERVER['REQUEST_URI'];
}
If you want it to be a must use plugin, put it in wp-content/mu-plugins/ instead of wp-content/plugins.

How custom template implement in opencart

I am new in Opencart, I have installed Opencart 2.3.0.2 in my xampp server.
I have a custom html template. How I implement it in Opencart ?
can I use the template in same store(opencart default) or another ?
Thanks alot.
Make copies…
To start with copy the default folder found in
upload/catalog/view/theme/default
to a new folder in the same directory. Name it “mytheme“.
Then copy the theme_default.php file in
upload/admin/controller/extension/theme
and place it in same directory. Name it “mytheme.php“.
Rename the class to (line 2):
ControllerExtensionThemeMyTheme
+ Replace all “theme_default” text to “mytheme“. Yes there are a lot (197).
Copy the theme_default.tpl in
upload/admin/view/template/extension/theme
and place it in the same directory. Name it “mytheme.tpl“.
Replace all “theme_default” text to “mytheme“. (48)
Copy theme_default.php in
upload/admin/language/en-gb/extension/theme
and place it in the same directory. Name it “mytheme.php“.
Set the new theme’s title in heading_title (line 3) to “My Theme”.
Finally for the thumnail image to show correctly in store settings rename default.png to mytheme.png in
upload/catalog/view/theme/mytheme/image
Now go into your Administration > Extensions > Extensions and select Themes in “Choose the extension type”. You should be seeing your new theme. Install it with the green (+) button and edit it to enable it. Also ensure you set the correct theme directory whilst editing the theme!
Then in System > Settings edit your store to use your new theme.
That should do it. You can now go ahead and start chopping and changing the default theme.

Categories