Thanks in advance for any clarity:
I havent worked directly with JQuery or JSON till recently and currently have an issue I dont understand.
A wordpress plugin that displays a sort of tv schedule --> displays on the deployment server when added but not on my development server. When I add the plugin the page sends me the following error:
Uncaught Error: Call to undefined function get_field()
Here is the actual line of code:
$ScheduleDownload = get_field('tv_printable_schedule', 'options');
I'm uncertain but I have a feeling that that is a JSON query... however the code doesn't recognize it.
Is JSON / Jquery installed incorrectly? Am i simply missing a basic understanding?
Thanks for your assistance
Thanks everyone .. here was the answer that aynber & TOH19 hit correctly:
https://www.advancedcustomfields.com/resources/installation/
you need to install advanced custom fields via plugin on the WP site.
Thank you!
Related
I am trying to develop a plugin for wordpress where at first I have to get the currency configured in woocommerce. When I try to save $string = get_woocommerce_currency(); I get a fatal error saying that the function get_woocommerce_currency(); is not defined. How can I get this value to get it and use it inside my plugin?
Thanks in advance!!
I have found the answer, you only have to get_option('woocommerce_currency'); like this $woo_currency = get_option('woocommerce_currency');
I have upgraded the Magento version to 2.3.7. After that, I have a strange issue on the checkout page that when it calls ajax function the URL is been wrongly generated. Previously it was like
/rest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods
but after upgrading Magento version now it's
/checkout/undefinedrest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods
Not sure from where this undefined gets added within the url ??
Research Notes: -
The secure & unsecure base url are correctly setup. I checked it again
Also i navigated to the file from where this ajax call is generated , the file is
vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js
Here the storage.post is from the ajax call is generated and it has
serviceurl & payload as arguments.
in getRates function - if we console.log "serviceUrl" then it shows the below url
rest/default/V1/guest-carts/FsS4QvllSq1vpuxZuC8ycQa0VRMOcQCy/estimate-shipping-methods
which seem to be correct, storage.post() function takes this as an argument and ajax request is called which then gets into the .fail() function
so what i think is that the problem is where the front part of the url gets added to it for making the ajax call that is
http://sitename.local/checkout/undefined ---> and here somehow the undefined gets added which breaks the whole url
The same issue is encountered by other users also but no solution is available yet.
https://magento.stackexchange.com/questions/256273/undefined-rest-api-checkout-cart
https://community.magento.com/t5/Magento-2-x-Programming/Magento2-Wrong-base-url-on-ajax-call/td-p/435435
Can anyone help me out from this?
I am answering my own question as i was able to fix the issue myself.
I am not sure if this solution would be a general solution to everyone facing similar issue but as in my case it helped me fix the issue , so it may guide others facing similar issue , if the solution isn`t 100% accurate in their scenario.
So in my project i had a file as
app/design/frontend/Birdbrain/default/Magento_Theme/templates/page/js/require_js.phtml
which had the following code inside it
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<script>
var require = {
"baseUrl": "<?php /* #escapeNotVerified */ echo $block->getViewFileUrl('/') ?>"
};
</script>
After removing this file from the source, the issue explained in the question above was fixed and no other issues arised by removing it.
Thoughts :-
As i checked in my version control system , i found that this file was added in 2017 and since then no changes were done in it, so after upgrading the magento version to 2.3.x , it somehow conflicted with some latest code and was no longer meaningful and so removing it fixed the issue , atleast for me.
My website had a older version of wordpress. Recently I upgraded it to the latest version. After that my php code what I write in the editor is keep getting disabled.
The old page which has php code in ti still works. Although in the editor the php codes are disabled. But if I try to save that it stops working. So i cannot update those page. And also I cannot create new page with php code in it
Exec-PHP plugin is installed.
If I write
<?php echo $c; ?>
It converts into
<!--?php echo $c; ?-->
How to fix that
attached image for better understanding.
Another way, which I don't quite recommend, is to follow this direction:
https://wordpress.org/support/topic/exec-php-to-work-in-php-7-needs-this/
This is basically updating the actual plugin, which will surely be overwritten by their next update.
This plugin requires a number of changes to work with php 7.
In exec-php.php
$GLOBALS[‘g_execphp_manager’] =& new ExecPhp_Manager();
must be changed to
$GLOBALS[‘g_execphp_manager’] = new ExecPhp_Manager();
In includes/manager.php from line 36
change each =& to =
In includes/admin.php lines 53,56,57,63,64,79 change =& to =
In includes/cache.php line 22,39 change =& to =
In includes/ajax.php line 64 change =& to =
I don't know about the plugin you use for this. However, I use xyzscripts for the same cause. It creates short-codes for me to use.
Here is an example:
Create your PHP code and get a Tracking Name.
You will then get your short-code as below, note the Tracking Name.
I personally think this is the best way as it allows re-usability and centralized location to update all your scripts.
XYZ WP PHP Code Download and Documentation
Thank you all for responding.
Apparently I find the solution by installing the Classic Editor plugin
https://en-gb.wordpress.org/plugins/classic-editor/
It prevents disabling the php code.
If you are facing similar problem you can try this one
I am beginner in cakePHP and woking on cakePHP 2.0. I am trying to generate CSV file, to accomplish this task i am using the following method.
cake php official site refr.
github refr.
i have got stucked in step no. 2 when it is loading the plugin. the following error is occurring in app/Config/bootstrap.php file
Fatal error: Class 'CakePlugin' not found in /var/www/html/sitefolder/app/config/bootstrap.php on line 51
CakePlugin::load('Export');
Please correct me.
Thnaks
Thnaks guys for your precious response on this
For now i have find the solution of this by following steps.
download the plugin files form
https://github.com/joshuapaling/CakePHP-Export-CSV-Plugin
by pass the step no.2 and step no.3 of what they have mentioned in official refer.
copy the file "ExportComponent.php" from plugin and paste it in
site_folder/app/controllers/components
add it in controller's component array variable
$components = array('blabla1', 'blabal2', 'Export')
create $data array variable (which contains the csv file data ) and just do like
$this->Export->exportCsv($data, 'filename1.csv');
Its done and working fine for me
I have inherited a custom wordpress theme and am doing a few changes to it (all cosmetics of changing city names, etc) , but at the bottom of a post I get the error : "Fatal error: Call to undefined function get_meta()"
In my functions.php I have this:
function bardetails(){
$web = get_meta('web');
$email = get_meta('email');
//...
}
I have a Java background but am new to php and wordpress. I dont see anywhere else this function is called, but must be tied to a post.
Have looked and can find a lot of problems about "get_post_meta()" and "meta()" but nothing about this. It also seems to be working on the other site the theme is on. I used FTP to pull over everything and all the other parts of the site seem to work fine. Looked at the database for something that could help with no luck, and also have tried to find if this is some kind of library, as the intention of the function is clear and thats to grab the website/email of the post.
So is this just a straight custom function? And if so were should it be defined in a php/wordpress setup?
It was due to a plugin that was not installed. "More Fields" By Henrik Melin, Kal Ström is a seemingly defunct plugin that was needed that allows you to use "get_meta()". For now, I just copied over the plugin but seems like I need to find an alternative going forward.