add simple texts to drupal contact form - drupal

I'm building a site and it has a contact page . the contact page uses contact module and it has some basic forms , what I want is to add some simple text like my personal email and phone number and ... to this page , but I couldn't find a way to do it . I'll be appreciated if you can help me with this
thanks
//--------------------------------------------------
finally found the answer! I made a file named "page--contact.tpl.php" and from there after
<?php print $feed_icons; ?>
I just wrote whatever information I wanted and it worked!

My suggestion ditch the contact form and go for Webforms You will thank me in the long run.

You can also create a block, add it above or below the form, then add your information to it. Simplest solution if you all you need is an area to add some details.

You can implement hook_form_alter() and then you can do whatever you want with the contact form.
See http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6 and http://www.metaltoad.com/blog/how-add-field-drupal-contact-form

Related

WordPress contact form 7 redirection

I want redirect contact us form 7 , for different pages,
I have multiple custom posts, and I want that when the user wants to read this, then first fill a form, and then redirect to full page. I want this process for every single post.
My test case can be seen here.
I am doing this:
on_sent_ok: "location.replace('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/');"
But this is for only one page.
If it doesn’t work, check if Ajax is correctly working on your site.
follow this link
http://contactform7.com/redirecting-to-another-url-after-submissions/
For redirecting your contact form after submission . This is perfect method ,
on_sent_ok: "location.replace('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/');"
But if you getting any issue then you can use redirection addon for contact us plugin .may be these link help you.
1:https://wordpress.org/plugins/tags/redirect-cf7/
2:https://github.com/anup04sust/Contact-Form-7-Redirect/blob/master/contact-form-7-redirect.php
3:https://github.com/kasparsd/contact-form-7-extras/blob/master/plugin.php
you need to call post id instead of this link ('http://polestarllp.com/casestudy/benefits-of-sql-on-hadoop/')
on_sent_ok: "location.replace('<a href="'. get_permalink($post->ID) . '"');"
hope it will work for you

how can i display contact us page on front page drupal 8?

I am creating scratch theme in drupal 8. Problem is occurred now i want to show contact us block display front page in footer right corner. I had used contact form module but it opens new page. I also used Contact block but result is nothing my concern is that how to does this?
If any one knows, tell me i do not have more knowledge about drupal thanks.
You can use this:-
$block = module_invoke('module_name', 'block_view', 'block_delta');
print render($block['content']);
You define a path to your form admin/content/webform.
Then you define your home page in Site Information admin/config/system/site-information.
More easy, contact block + twig tweak module, get the frontpage node theme sugestion, in my case node 2, -> node--2--full.html.twig and theming it.
content.field_my_field for fields and
drupal_block('mymachinenamebock') -> drupal_block('contactblock') got by the twig tweaks module
You can include the contact form to the footer region by modifying your theme's your_theme_name.theme file.

Wordpress static Form on any page - Plugin, Widget or Shortcode?

I am frankly new to wordpress but programm in PHP.
Task:
I have a form (don't wanna use a form plugin) and want to include this form on either 1. Sidebar or 2. within content of any Page except one (Contact-page).
I want to programm the Widget, Shortcode or Plugin bymyself. I don't need a tutorial how to programm this.
Question:
What do you advise me to use: a shortcode, plugin, widget or a "hack" in the template (f.e. if ($page!=="contact"){...}
The answer should consider
Ease and flexibility of use
Short time to develop
Speed of Rendering
Thanks for advise of experienced Wordpress Users/Developpers.
PS: the form is very simple maybe there is even another fast way you know how to do this.
Try This
1)first to fall you make a page templates of contact page.(make copy of page.php than only change the name of templates)
2)than that template in you make your custom form.
3)that page template you apply in your contact page.
Make a template-myForm.php file, and populate it with following:
<?php
/**
* Template for displaying search forms for My Web Site
*
*/
?>
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<!-- your form content-->
</form>
Add to site <?php get_template_part( 'template', 'myForm' ); ?> where you want a custom search form. I used it for search form, so it was easy to make it into widget also. I used separate template file for site search, and searcform.php for search widget. If you are aiming at different kind of form tag, you have to create that a Widget.
It is a class Your_Widget extends WP_Widget, which for you can find tutorials on your own, or just check out PHP code file: wp-includes/class-wp-widget.php in your Wordpress copy and extend it. Me personally use tutorials. I find it more simple.
So, to summ up, you would have two copies of your form - one to show as a template part, and an another one for sidebar or other registered widget area. If it is identicall in both versions, using this solution you would have to remember to keep changing it in two places (which is again simpler than hard-coding).
For me beeing not a native English speaker and just a part time Wordpress coder, this is what I offer. More integrated and PHP-programming-friendly solution, find in Wordpress forums, here on stackoverflow and Wordpress.org site.
I also am aware this is not exactly what you are looking for - not using shortcode. I hope this will kick you off into Wordpress world, and you will find how to offer a custom form to your users!
Good luck!

WordPress MetaSlider & Advanced Custom Fields integration

I'm building a website in WordPress using the Advanced Custom Fields plugin alongside metaslider, I want the user to be able to select a metaslider from a dropdown list by using a custom field.
I know that you can add a slider in via the WYSIWYG however I want to make a seamless way of doing this, it's probably not as simple as I'd like it to be.
The website consists of projects and will have several sliders all will be appropriately named and I want to make it foolproof for the user.
I've searched online and can't seem to find anyone else who has wanted/tried to to this.
Ask an questions you have if i haven't been clear!
Any help would be greatly appreciated.
It's okay, I figured out how to do it!
You can select a field type of "post object" then add a "post type" of Meta Slider then the user has a dropdown box where they can select which slider they want to display on the page.
Metaslider shortcode id in ACF:
$slider_object['value']->ID
Try:
<?php $slider = get_field_object('slider_item'); ?>
<?php echo do_shortcode('[metaslider id="'.$slider['value']->ID.'"]'); ?>

Place an Edit Button on the view node page in Drupal 7

I don't use the Drupal Tabs because they interfere with my CSS but I need the functionality of the Edit tab to be on that screen so that a user can edit the node after reviewing it.
Any ideas on how to do this? Functions? tpl placement? Thanks!
You can do this in a custom module as follows.
In yourcustommodule.module you implement hook_preprocess_node(). In there you check if the user has permissions to edit the node and you set the edit link.
function yourcustommodule_preprocess_node(&$vars) {
if (node_access("update", $vars['node']) === TRUE) {
$vars['edit_link']['#markup'] = l(t('Edit'), 'node/' . $vars['nid'] . '/edit');
}
}
In the node.tpl.php template in the theme you print the edit link if it is available.
<?php if (isset($edit_link)) : ?>
<p><?php print render($edit_link); ?></p>
<?php endif; ?>
If you do not have a node.tpl.php template in your theme folder than copy the one from modules/node.
If you're using the Views Format "Fields", one of the fields that you can add is "Edit Link." It's pretty flexible; it will tell you what text to display in the link. That's probably the preferred option.
If you're not using the "Fields" format, it gets trickier, especially since you're already interfering with some basic drupal styling. I'd need more information about your View and your skill set to recommend a method that doesn't cause more problems.
As a sidenote: I learned Drupal theming from the outside in, and used to use CSS that would interfere with the underlying drupal mechanics like tabs and contextual links. I've moved away from that; I find very few cases where I need to interfere with native styling-- and for those I can use custom .tpl's to get around.
EDIT: Ah. If you're not using views, a custom page .tpl is probably the best way to go. If you're not familiar, the structure for any node edit link is '/node/<NID>/edit' (for clean URL's) or '/?q=node/<NID>/edit' for old-style URL's. Depending on how your path aliases are set up, '/<url-alias>/edit' may work as well but the previous ones are more reliable.
This link on drupal.org gives a few options.
I think u can write a theme file(.tpl) for u specific case and theme page in whichever way u want

Resources