I'm using the Genesis framework for WordPress and the Business Pro theme.
I want to customise the contact page and if you view the URL below, you can see the Email and Telephone sections that I want to create next to the form.
My question is should I create custom page template or use functions.php to target the contact page using a conditional. I guess I'm trying to find out best practise or if one method is better than the other in this case.
It does not matter how you create a contact form and add it to the page.
You can use a contact form in a page template. It is easier to manage than managing one function in functions.php file having a lot of functions in it.
Another option - is if you use "Genesis framework", use it further.
Otherwise, the part of the site with the framework and other through the code via ftp...
Make a page with this framework, there create what you need.
It will be easier to maintaining a site in the future. Especially if you make a website for a client who is unfamiliar with development.
You could use the Genesis Simple sidebars plugin to create a custom sidebar which only displays on the contact page and populate that widget area with your email and telephone details.
No need for a template but if you want to, create a file named contact.php in your child theme folder and add the following code to the file :
<?php
// Template Name: Contact
genesis();
You can then select the Template named Contact from the Page Attributes box on the Edit Page screen,
Related
I'm very new to WordPress (tbh, it's my first time working with it). And I need to make a website as my school project using CMS. Creating pages with templates is alright, but I have a lot of troubles with buttons. I found this website, and I can see it using WordPress. I need such buttons as on this page https://movie-chooser.co.ua/random-movie-2/ (they appear when you hover over the image). Is this a default option for buttons in WordPress? If not, is there a plugin for this or what is the way to add them on my images?
First Install Elementor plugin https://wordpress.org/plugins/elementor/
and go to page when you add button and open page with elementor
and do drag and drop any element like button, space, text editor etc.
You have several ways to achieve that:
Overwritting Wordpress CSS
Using a plugin
Create your own shortcode
1 - Overwriting Wordpress CSS
If you manage to display all the elements using wordpress template, and your only issue is to display buttons over the images, then it should only be a matter of CSS
2 - Using a plugin
The idea here is to find a plugin that help you to create/display the informations you need (maybe you'll need to add functionnality to basic post though custom fields or using a custom post type).
Once you find the right plugin, again if the plugin dosen't directly offert some settings on the design then you'll have to overwrite the plugin's CSS rules to display the elements as you want.
3 - Create your own shortcode
If you're new to Wordpress I wouldn't recommend this method as it is kind of advanced, unless you're comfortable with PHP/HTML/CSS (optionaly JS).
This is the more flexible solution as you can basically control anything, but it will require you to understand some core concepts of Wordpress like WP Query and how custom queries works.
The idea here is to create a shortcode.
THis shortcode refere to a custom made PHP function, in which you can create a custom request to fetch the informations you need to display from Wordpress database, and display it in an HTML structure that you decide.
THen angain, you'll just have to customize it though CSS.
Note : no need to create a whole plugin if you decide to create a shortcode, you can use the template functions.php file for that.
I am building a website for a local builder and he asked me to create a 'Project' functionality where he could add a Project, fill in the information and add photos and then have a page called 'Projects' where the new project automatically goes on to the page which then links to a page about the project in more detail.
Using Advanced Custom Fields, how would I create something like this?
Do I use the Page system or do I create a custom ACF options page just for projects? Each Project will need its own page and the project title and image must be accessible from the page footer as 6 of the latest projects will be shown there.
Any help would be appreciated!
I would probably not use Advanced Custom Fields for the projects but a custom post type called "Projects"
Register a Post Type
https://developer.wordpress.org/reference/functions/register_post_type/
Or Using a Plugin
https://wordpress.org/plugins/custom-post-type-ui/
This will give you a new Projects section just like pages or posts and I would use Advanced Custom Fields to add fields to the projects so you can add additional information on the project such as photos and any other fields a project might require.
Custom Post Type archive pages are accessible via www.yoursite.com/projects which will list all of the projects using the default template one of
single.php
archive.php
depending on your theme then each single project will have it's own page too at www.yoursite.com/projects/project-name these will probably use one of
single.php
singular.php
index.php
https://developer.wordpress.org/themes/basics/template-hierarchy/
You can create custom templates for both of these by creating files named
archive-projects.php
single-projects.php
The footer would be a different issue you'd need to loop through your projects using one of
get_pages();
get_posts();
WP_Query;
https://codex.wordpress.org/Function_Reference/get_pages
https://codex.wordpress.org/Function_Reference/get_posts
https://codex.wordpress.org/Class_Reference/WP_Query
i'm writing my first Plugin for Wordpress. A booking calendar. The Admin and Setting Page is already working. The Admin has the possibility to create, edit and delete bookings. I'm struggling with the Front End.
How do i call my "Create a Booking" Form for the User?
Do i need do create a separate Page for that or is it possible for the Admin to call my "Create a Booking" Form in every Page?
There are many ways... The simplest would be to put your form directly into the content of a page or post. In that case, anyone could access the form. If you need to dynamically determine how the form is displayed, you'll want to put it into a shortcode, or use a Wordress page-template in your theme [confusing, because this is totally different from a page!]. Use shortcodes to port your project to any theme, use page templates to lock your functionality into one specific theme. To alter every page, you would put your functionality in a plugin, or in your theme's functions.php file.
https://codex.wordpress.org/Shortcode_API
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
For all pages, Wordpress give us a default page template : page.php. That's clear and simple, by default all pages use this template. Then, Wordpress give us a page template system, and when we speak about template we think reusable so we think about page layout template.
For example : full-width, page-width, sidebar-left... You specifie the template to use for each page, it's ok.
But when you begin to work on a more complex web site, your content will not be a simple post (page type) inside a page template anymore. For a reason or another you have to use another feature of Wordpress : page-slug.php. Before, of course you can try to do shortcode for everything you develop, include specific plugins only for your complex page etc but ONE DAY, you will have no choice to use this page-slug.php.
Here comes the problem : the content is "more specific and complex" but you still need to use your layout template, and you can't... Of course, you hate duplicated code so you don't want to just "copy" your template inside.
If we really want a specific page, we use the page-slug.php without a page template and it do the job. Then...
Why Wordpress don't consider the page-slug.php as pure content when (and only when) a page template is specified ?
Am I missing something ?
Thanks
I have a client that wants to have a custom form added as a page on his Wordpress site. His site is using the "Genesis" framework and is already using a child theme of "Manhattan". I can create the form as a page template from within the Manhattan directory but if they ever update, the changes will be lost. What should I do?
I suggest you make it a plugin with a shortcode that way you can use it on every page you want. And even posts (which don't use templates)
You also could take a look at form plugins, which are fine if you don't need advanced forms.
As long as you place your template inside the Manhattan directory -- assuming you don't place that directory inside of the Genesis directory -- you won't have a problem with over-writing on update of the Genesis theme. Child themes do not have to be inside the parent theme's directory, indeed, they sd not -- they sd be in the /themes directory. See, http://codex.wordpress.org/Child_Themes
it is a very complex form?
If you add a custom template to the existing theme you may loose the changes when the theme is updated.
If is a simple form, I'd use a plugin like contact form 7, or caldera forms.
If not (or you don't wan't to use a wp.org plugin), you can create your own plugin and register a shortcode, you can write all the form functionality at the plugin and use the shortcode in the WP editor.
This way you won't have any risks of loosing features due to a theme upgrade