I'm using Gravity Forms with Wordpress, and I got a problem :
When I insert manually a form in a post, it won't display it. Instead I have this :
(...) pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
[gravityform id="13" title="true" description="true"]
But, If I embed this form in php, it works perfecty!
gravity_form('13', true, true);
I need manually displaying to work in order to let my client manage his forms as he wants.
Everything is up-to-date, I don't use plugins except Polylang which is not causing conflict regarding the System Status.
Any ideas?
Thanks in advance :)
EDIT :
I was using themosis for this project.
Themosis have a conflict with plugins as Gravity Forms. More info here :)
https://github.com/themosis/framework/issues/220
// Try to add a shortcode in you theme's functions.php file if its the only occurance!
function gravityform_func($atts) {
$args = shortcode_atts( array(
'id' => null,
'title' => true,
'description' => true,
), $atts);
return gravityform($args['id'], $args['title'], $args['description']);
}
add_shortcode('gravityform', 'gravityform_func');
WordPress shortcodes are built in WordPress functionality. If they aren't working there is something else going on with your WordPress install. The first thing to do is to check for possible plugin or theme conflicts.
Activate the default WordPress theme and test to see if the shortcode works
If it does then something in your theme is causing the issue. If it doesn't then:
Deactivate ALL plugins
Activate only Gravity Forms
Test the shortcode
If it works then another plugin is causing the issue.
Activate each plugin one by one
Test the shortcode after each plugin is activated
Also make sure you insert the shortcode in the post editor in HTML mode and then update your page. Shortcodes are native functionality to WordPress so something is preventing WordPress from parsing the shortcode.
Related
I'm working on a website, which is multilingual.
We're using Polylang and the ACF custom fields plugin.
Works fine in general, the issue is with the ACF Option pages.
The option pages are translated also in different languages.
The content we are taking from there is being displayed according to translation - in english on the english version of a page, french on the french etc.
The problem: We have a contact us form, where we take the recipients email address from the ACF option pages.
(We want to send it to a different recepient when its a different language.)
Here it always takes the email address from the default language option page and I don't understand why.
We are taking the email recipient for the ajax call with get field command, like on pages displaying content:
get_field('service_email', 'option' );
Anyone got an idea what could cause this? Or where to look?
In the end we found the solution. It took a bit of digging, but I hope this helps if anyone encounters the same issue.
We needed to add the following setup in the functions.php of our theme to have the ACF options pages also translated for the each language:
// Translating Options Page Compatibility
// add filter with the path to your acf installation
add_filter('acf/settings/default_language', 'my_settings_default_language');
add_filter('acf/settings/current_language', 'my_settings_current_language');
function my_settings_default_language( $lang ) {
if($lang == "") {
$lang = pll_default_language(); // pll_ is a polylang function
}
return $lang;
}
function jfrog_settings_current_language( $lang ) {
$lang = pll_current_language();
return $lang;
}
Side Note: We're using a theme installed version of ACF.
hope this helps, Cheers
I have a question. I am using WPML plugin. In WPML->languages->Language switcher options i checked "Link to home of language for missing translations". Now when i click language switcher country flags and translation is missing it will redirect to homepage. My question is how to redirect to custom page when translation is not found. I want to create page with text "Sorry translation is missing. Please contact us for more info..."
Thank you for your time
First make sure you have WPML->languages->Language switcher options "Link to home of language for missing translations" checked. Then create your custom translation not found page in main language and translate it to other languages using WPML. Then add this code to your functions.php
add_filter('wpml_ls_language_url', 'redirect_link',10,2);
function redirect_link($url,$lang){
if($lang['missing'] == 1) {
$permalink_to_translation_not_found_page_in_main_language = get_the_permalink(40); //40 is page id of a custom translation not found page in main language
$lang['url'] = apply_filters( 'wpml_permalink', $permalink_to_translation_not_found_page_in_main_language , $lang['language_code'] );
}
return $lang['url'];
}
I hope this is useful for someone
Does anyone know how to limit the autocomplete suggestions of Link Fields to only certain bundles -- not globally, but per Link Field instance? I nearly found a solution in customizing https://github.com/minnur/Alter-Entity-Autocomplete , but this is global for all autocompletes, and I need to get the calling Link Field instance somehow.
This is possible with hook form alter:
function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// if $form_id == 'xyz'
$form['field_mylink']['widget'][0]['uri']['#selection_handler']="default:node";
$form['field_mylink']['widget'][0]['uri']['#selection_settings']=[
'target_bundles'=>['article'=>'article', 'page'=>'page'], //etc
];
}
I have written the following Drupal contributed module to solve the issue:
Link Field Autocomplete Filter
The module adds a Link Field configuration for filtering the allowed
content types in the autocomplete field.
You can install the module manually with the drupal core Update Manager module (must be enabled) using the Drupal backend:
http://yourSite/admin/reports/updates/install
and follow the instructions there.
Using Drush, you can install it with:
drush dl link_field_autocomplete_filter; // download
drush en link_field_autocomplete_filter; // enable the module
You can also us Composer to download the module:
composer require drupal/link_field_autocomplete_filter
Simply enable the module, and a series of checkboxes (one for each content type) will appear in the Link Field field-instance configuration form. If you check none, then all content types will appear as suggestions in the autocomplete. Otherwise only those checked will appear.
I am coding some permalinks rewrite for WooCommerce awesome plugin.
Everything is well packed in a plugin and work well... except for one thing.
WooCommerce use get_term_link() to display HTML link in default template. A lot of custom templates use it too. If I want to display the good link on my website, I must change one line of code in woocommerce plugin. This is dirty, since basic user would not do it. Since I want to list it on Wordpress plugin repertory, I would like some help here...
What I need to do :
Open woocommerce.php and replace line 767 :
OLD
$product_category_slug = empty( $permalinks['category_base'] ) ? _x( 'product-category', 'slug', 'woocommerce' ) : $permalinks['category_base'];
NEW
$product_category_slug = '';
Very easy to do by editing the file, but it is dirty. It is non user friendly, and it depends a lot of woocommerce next version... So my question here: how can I do it from my own plugin, without asking people to open their woocommerce plugin with Notepad++... Is there any way ?
I hope you understand my need and could provide me with an answer :)
I already did same thing in Past.
Please Don't Modify WooCommerce Core files, Because it will be gone in your next upgrade.
Use this Custom Permlink Plugin, You will get Better Options there,
I want to create a wordpress plugin where it adds additional controls underneath the WYSIWYG editor when adding pages/posts. But I don't know what keywords I'm supposed to google for to find relevant tutorials on how to do it.
Can someone provide me with resources?
It's called add_meta_box() - call it within a hooked admin_init function like so;
function my_custom_meta_box()
{
add_meta_box(
'my_meta_box_id',
'My Meta Box Title',
'my_meta_box_callback',
'post', // either post, page or link,
'normal', // position of the meta box,
'high' // position priority
);
}
add_action('admin_init', 'my_custom_meta_box');
function my_meta_box_callback()
{
echo 'This is the content of my meta box!';
}
Do you want the filter reference for hooks to add to the editor? Plugin API/Filter Reference « WordPress Codex There are lots of plugins that add controls to the editor: WordPress › WordPress Plugins - TinyMCE
I've written a good tutorial on adding WordPress Meta Boxes additionally check out my WPalchemy Meta Box PHP Class which will help you create meta boxes with ease.