We have a website and on some pages we don’t run the standard WordPress headers and footers. We however still would like our header & footer code from your plugin to run.
Is there a way to manually call in the code in the “Header” or “Footer”-field in the “Global Header and Footer” section using PHP?
Thank you in advance!
]]>To show the form on a page you need to call a shortcode, for example “[forminator_form id=”62″]”. The problem is: on a different site, the ID of the form is going to be different right?
What i can guarantee is the title of the form on my plugin is 100% going to be the same (example: “Kemal’s Registration Form” or in this case “test form”)
now, I have made a function to get an id of a post by entering the form title and a shortcode to echo the form’s id. However it’s showing nothing so far. here’s the code:
//this function is to get a page id by title
function getPageByTitle( $page_title, $output = OBJECT, $post_type = 'page' ){
? ? global $wpdb;
? ? if ( is_array( $post_type ) ) {
? ? ? ? $post_type ? ? ? ? ? = esc_sql( $post_type );
? ? ? ? $post_type_in_string = "'" . implode( "','", $post_type ) . "'";
? ? ? ? $sql ? ? ? ? ? ? ? ? = $wpdb->prepare(
? ? ? ? ? ? "
? ? ? ? ? ? SELECT ID
? ? ? ? ? ? FROM $wpdb->posts
? ? ? ? ? ? WHERE post_title = %s
? ? ? ? ? ? AND post_type IN ($post_type_in_string)
? ? ? ? ",
? ? ? ? ? ? $page_title
? ? ? ? );
? ? } else {
? ? ? ? $sql = $wpdb->prepare(
? ? ? ? ? ? "
? ? ? ? ? ? SELECT ID
? ? ? ? ? ? FROM $wpdb->posts
? ? ? ? ? ? WHERE post_title = %s
? ? ? ? ? ? AND post_type = %s
? ? ? ? ",
? ? ? ? ? ? $page_title,
? ? ? ? ? ? $post_type
? ? ? ? );
? ? }
? ? $page = $wpdb->get_var( $sql );
? ? if ( $page ) {
? ? ? ? return get_post( $page, $output );
? ? }
? ? return null;
}
//this code is to echo the id if the function success
add_shortcode('wd-couple-form','show_couple_form');
function show_couple_form($atts){
? ? $pagename = getPageByTitle('test form');
? ? echo $pagename;
}
I think I am a literal stupid, know that get_page_by_title function has been deprecated but can’t get WP_query to work properly, and i stole that function from Stackoverflow, and can’t get it to work.
now, what I’m thinking is this :
1. Is there a way in Forminator’s API to determine the Form’s ID? that way I don’t need the hassle of making an abomination of a function like above
or
2. Where did I do wrong on the function that I tragically copy-paste. because the add_shortcode part is sure as hell too simple to fail.
p/s: you might want to explain to me as if I’m 5 years old or as if I’m a cat.
Thanks for your help!
However, i would like to limit some of them to 2 of the discounted product and i can’t find the method for doing so. Can you help me with the right method?
These are the limitations i’m using so far:
$coupon->set_individual_use( true );
$coupon->set_product_ids( array( 10063 ) );
$coupon->set_usage_limit_per_user( 1 );
$coupon->set_usage_limit( 1 );
]]>Is there any function that let us shorten link programmatically? (when url shortify plugin is installed and activated?)
Thanks
I want to develop a Lazy Block without adding by WordPress Admin. I have seen docs and I don’t understand examples there. I have success only with exported code from plugin, but i can’t put template path, for example:
…/<my_theme>/functions.php:
if ( function_exists( 'lazyblocks' ) ) :
lazyblocks()->add_block( array(
....
'code' => array(
...
'frontend_html' => '/blocks/lazyblock-hello-world-block/block.php',
...
),
`
ideally I would split code into multiple files (frontend, editor, css and js) of the block.
Thanks in advance!
]]>Does the popup need to be active? I would like to use it only programatically but there is no option for “no trigger at all”.
Also, when I try to call it I get the following error:
“Uncaught TypeError: Cannot read property ‘showPopup’ of undefined
at (index):1”
I am calling it by adding this on functions.php (inside some function):
echo “<script>”
. “console.log(‘Test started’);”
. “window.wppopups.showPopup(32655);”
. “</script>”;
It’s been registered with an add_action(‘init’, ‘functionName’); and I’m getting the “Test started” on console.
I do get the “Test started” but it seems wppopups is not loading.
Even after the page is completely loaded, if I try to “window.wppopups.showPopup(32655);” on my console, I still get a “undefined” as a response.
On the other hand, if I activate the popup I get the following error (which breaks my site):
“Uncaught TypeError: Cannot read property ‘charAt’ of undefined
at Object.bindPopupTriggers (wppopups.js?ver=2.1.2:317)
at Object.initPopup (wppopups.js?ver=2.1.2:147)
at HTMLDivElement.<anonymous> (wppopups.js?ver=2.1.2:106)
at Function.each (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
at jQuery.fn.init.each (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
at HTMLDocument.ready (wppopups.js?ver=2.1.2:98)
at i (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
at Object.fireWith [as resolveWith] (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
at Function.ready (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
at HTMLDocument.J (jquery-1.12.4-wp.js?ver=1.12.4-wp:2)
bindPopupTriggers @ wppopups.js?ver=2.1.2:317
initPopup @ wppopups.js?ver=2.1.2:147
(anonymous) @ wppopups.js?ver=2.1.2:106
each @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2
each @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2
ready @ wppopups.js?ver=2.1.2:98
i @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2
fireWith @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2
ready @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2
J @ jquery-1.12.4-wp.js?ver=1.12.4-wp:2”
Please any ideas on how to fix this?
Thank you!
]]>Try to use functions from shortcode, no luck.
Thank you.
]]>So far i’ve found
$delivery_zones = WC_Shipping_Zones::get_zones();
foreach ($delivery_zones as $key => $the_zone ) {
echo "<pre>";
print_r($the_zone);
echo "</pre>";
}
which gets the zone name, but doesn’t retrieve the actual rates. I have a zone for U.S. and a zone for Canada, and would like them both to display.
Any suggestions by chance?
]]>I need to enable maintenance mode via php script.
Every day I run a script on my website to update content, I would like during the execution of the scritp my website to appear in maintenance mode.
Is it possible to enable / disable maintenance mode of the plugin with some code written in my php script?
]]>