How to change contact from 7 spinning arrow location? - php

i have used Contact from 7 in my WordPress Theme, there are lot of options but i did not find any option to change the location of the (loading/ spinning arrow).
i want to display loading arrow on the Top of contact from.

This is pretty old but maybe somebody still needs an answer.
To override the ajax loader the right thing to do is to filter out the CF7 php function wpcf7_ajax_loader with a custom one.
Just place this function inside functions.php inside your theme and you should be good.
# Override ajax loader
add_filter('wpcf7_ajax_loader', 'custom_wpcf7_ajax_loader');
function custom_wpcf7_ajax_loader () {
return get_bloginfo('stylesheet_directory') . '/images/custom-ajax-loader.gif';
}

Related

Read POST data in Wordpress page

I am trying to write a plugin for wordpress. I have a problem i can't solve.
Inside plugin i habe added a shortcode that show a form.
function showForm() {
echo '<form method="post" action="www.example.com/myDestinationPage">';
[...]
}
add_shortcode( 'ShowFormSC' , 'showForm' );
After that, in a page, i added the shortcode and it works perfectly. ;-)
Now the problem: how can i read POST data in myDestinationPage (another wordpress page)?
In Php would be very simple ... but in wordpress I do not know how to do.
Second problem: myDestinationPage must be a real wordpress page with another shortcode inside, or can be defined as a "virtual" page inside my plugin?
Thank you for your help!
Best Regards,
Simone
www.example.com/myDestinationPage needs to be edited to recieve the post data, just as in any other php script, wordpress or not. If 'myDestinationPage' resolves to dynamic wordpress content, then you are in muddy waters.
Let's say, myDestinationPage is a wordpress Post. That "page" doesn't exist as a file, it comes directly from the database.
You could write a shortcode which handles this though:
add_shortcode('post_parser', 'postParser');
. . .
function postParser() {
filter_input(INPUT_POST, 'my_post_value');
//do something
}
Then, you just add the '[post_parser]' shortcode to the myDestinatioPage Post. (You mentioned it's a wordpress page, but page & post are both WP_Post objects.)
Another option is to put your post processing code in the post.php (or whichever template myDestinationPage is).
1st answer: you can directly use $_POST in wordpress like in php.
2nd answer: Yes you can. If you want to use pages in your plugin, use plugins_url() to generate the path for form action.
https://codex.wordpress.org/Function_Reference/plugins_url

Prestashop module hook to product pages

I am developing a module in prestashop. The module has been hooked into left column and right column and its working fine with that. Now I want to show the module output in product footer page. So for that can someone tell me how to hook my module to the product details page? Any help and suggestions will be really appreciable.
My code for leftColumn and rightColumn is like this
function hookLeftColumn()
{
$defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
global $cookie, $smarty;
$value=array();
$result="SELECT status,app_id from "._DB_PREFIX_."storeblocks";
$value=Db::getInstance()->ExecuteS($result);
$smarty->assign('array',$value);
$smarty->assign('default',$defaultLanguage);
return $this->display(__FILE__, 'stores.tpl');
}
function hookRightColumn()
{
return $this->hookLeftColumn();
}
For product page, there are several hooks available in PS.
You can use displayLeftColumnProduct hook, which hooks modules just below the image of the product. You can also use displayRightColumnProduct which is for the right side section.
Another set of hooks is displayProductTab and displayProductTabContent , which are used for the tabs on the product page.
If these hooks don't help you, simply, then there are several other ways you can get your results. You can hook your module to any of that hooks which is more suitable for your needs, and then using css position and lft , top etc to move that hook to the required place.
If that is not a choice, then you will need to create your own hook and then using that hook on the product page. Please read this for creating your own hook
http://www.programmingtunes.com/creating-new-prestashop-hook/
Also for a complete list of the hooks in PS, please read this article in PS docs
http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5
Let me know if you still need any other details.
Thank you
notice:this answer is about prestashop 1.5 and also you can use it for prestashop 1.6 too.
if your means about product details page is the more info tab as i show in bellow image i can help you
step1.you should instal two hook in install function in your module
public function install() {
return parent::install() &&
$this->registerHook('displayProductTab')&&
$this->registerHook('displayProductTabContent')
}
step2:you should use them and return the some html code
i want add a new tab i use.
notice:id is dynamic you change it but class is static should be use as the selected.
also href is linked to the content id(you see that in step 3)
public function hookDisplayProductTab($params) {
return '<li>
<a id="myid" class="selected"
href="#linked">mytab</a>
</li>'
}
step3:if want when you click on mytab this show the it's content you add an other function.
notice:the href="#linked" at previous function is linked to the id="linked".
public function hookDisplayProductTabContent($params){
return <div id="linked" class="rte">
<div class="product-overview-full">
my contents
</div>
</div>
}
advanced:write your html or smarty in your .tpl and return theme weth this code
return $this->display(__FILE__, 'mytpl.tpl') ;
best regards.

Wordpress can't find php file in correct directory

I'm getting into wordpress and I've been following some pretty good tutorials and reading through the codex but I've encountered a problem which I can't seem to find the answer to anywhere else. Eventually my plan is to create an interface for users of my theme that will allow them to change colors, widths, positioning, etc. of certain elements in the template. Basically it will be a php file that will generate a css document. For right now though all it does is echo a sentence. I'm not sure if this is technically a "plug-in" but when I try to put it in the plugins folder, I end up with a 404 error. I know the file is there and I have triple checked the path. I have also tried navigating to the php file directly in the url but I still get a 404 error. I have also tried using the plugin template. It echoes the sentence when I click "activate" in the plugins manager, but it does not work at all when calling it from the functions.php file. Any help is greatly appreciated.
Here is the code which I have placed at the end of my functions.php:
//begin template specific*******************************************************
//------the function below styles the wordpress admin menus.-------
function custom_style() {
echo '<style type="text/css">#adminmenu .wp-menu-image img {padding: 0px !important; margin-left: -3px;}</style>';
}
add_action('admin_menu', 'register_custom_menu_page');
add_action('admin_menu', 'custom_style');
//------this function adds the template specific menu item.---------
function register_custom_menu_page() {
add_menu_page('Epsilon', 'Epsilon', 'add_users', plugins_url('epsilon/eps-manage.php', eps-manage.php ), '', content_url('themes/epsilon/images/eps-icon.png'), 6);
} // this function creates the correct path as far as I can tell, but when I click the link button in the admin menu, I get the 404.
//------this function hides the editor option under the appearance menu ----------
function remove_editor_menu() {
remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);
Why am i getting this 404 error and is there a more correct way to do this?
You are trying to merge a plugin and a theme. plugins_url will only load up the file of a registered and activated (not sure on the activation 100%) plugin, As you are developing a theme it is better to have your management files relative to your theme folder, but to be honest for this type of job as you are a begginer I would keep everything in functions.php and use functions as the callbacks to your menus.

Wordpress basic concept - how to extend/override/customize a plugin hook?

I am working on a wordpress site and would like to clarify a basic concept that is definitely very important, and this is how to customize/extend a wordpress hook (at least that's what I think I want to do!)
As the real world example, I am setting up a wp-ecommerce site. When a user adds an item to the cart, I would like to do one or two more things than the original function does. Looking through the source, I find:
/wp-content/plugins/wp-e-commerce/wpsc-includes/ajax.functions.php
with the function:
function wpsc_add_to_cart()
I know I could simply edit the code right here, but obviously that is the completely wrong way to go about it as when the plugin is updated, I will lose changes. What is the correct way to extend a function that is part of a plugin, or wordpress for that matter?
Endless thanks in advance.
You can use the wordpress action hooks to resolve the code loss while plugin upgrade.
You can remove the function which is in plugin file by using remove_action hook and do your own code by adding add_action in your function.php file. So that you can customize your plugin code from theme's function.php.
Here are the examples to explain.I hope it will help.
http://codex.wordpress.org/Plugin_API
http://themeshaper.com/2009/05/03/filters-wordpress-child-themes/
I use a little supressed notice function (it lives in my child themes function.php page), for plugins that get irritating eg: please setup twitter account to use , this kind of warning is not useful at certain stages and sometimes just do not care for it.
function supressed_notices_active(){
echo '<div class="error"><p>Supressed Notices are active</p></div>';
}
if(function_exists('the_plugin_custom_function_call')){
remove_action('the_plugin_custom_function_call' );
add_action('admin_notices','supressed_notices_active');
}else{
function test_message_from_me(){
echo '<h1>show</h1>';
}
add_action('admin_notices','test_message_from_me');
}
So I create the supressed notice function to at least create a warning, so i remember.
Check if the target function exists with the function_exists($target_function) hook
then remove this action from running with the remove_action($tag,$target_function) hook
then just add your custom function with the add_action($tag,$target_function) hook (do not need to have a separate function this could just be a closure)
then else if the function does not exist either still run a new action or leave this section, it can be useful for testing to just add anything so you atleast get some feed back.
What you could try... Copy the function within the plugin file,
paste it into your themes functions.php file,
ie:
function wpsc_add_to_cart() {
global $wpdb, $wpsc_cart;
// default values etc..etc..
// new code here?
}
the only thing with this is, if the plugin is updated and that funciton is renamed or removed, changed or something you could start to run into trouble...
could you not ask the plugin developer to possibly add your requirements to it,
possibly for a small fee? but if your using it as your main shopping cart, then chances are, that small investment could be a good thing.
Marty

Need help with Jquery selectors on drupal

I'm having problem with Jquery on Drupal.
Here is what I'm trying to achieve, I needed to get the html() of my primary link. For example one of my primary link have a sub menus/child menus. I need to get those child menus using Jquery. My problem is I can't retrive it using $("#menuID").html(), it always returns null. It seems that the page was not yet fully loaded when the function was called. I placed it inside $(document).ready() but still won't work.
file.js
$(document).ready(function(){
console.log($('#id-of-the-menu').html());
});
I called file.js on page.tpl.php
Any help is greatly appreciated.
Call in your page.tpl.php the file.js after the "<?php print $scripts ?>"-tag in the head.
Also if there is more javascript action going on (collapsing menus, ...), look at the source of the page to see if there is inline-javascript and if so, even call your file.js at the bottom of page.tpl.php .
It could be the menu hasn't loaded because a module is preventing it to load in a normal way (but then we'll need more info on the modules you use).

Categories