Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm entirely new to WordPress but have been tasked with creating a website for my uncles business. I'm trying to understand a bit more about the mechanics of WordPress before I do any more coding so I have a question about index.php / front-page.php.
I had been working on index.php before I even decided to implement WordPress so everything is hard coded. So at the moment I have a fully populated index.php file that I custom designed myself. My understanding of WordPress so far is that everything is dynamic. So I feel like what I should have done is created a front-page.php with a function within it to call the static 'Front page' that I create within the WordPress GUI, then outputting it using the_content();?
Is it okay to have hard-coded in WP, or is this against best practice? Obviously with my current implementation we will not be able to edit the file. How would I go about editing the CSS for this - For example I have a div named 'services' with a background image for this div in the CSS. How would this be implemented from within WP?
Ok i think you got it wrong, wordpress works on themes. In order to make your html design work with wordpress you will first have to create theme. Creating a basic theme is as simple as creating a new folder. Here are some of the basic files that are important, and difference between index.php and front-page.php.
style.css, This file will contain some comments that will define
the details about your theme
Header.php, The header part of your html design goes in this file including the main menu and slider.
Footer.php, the footer part i.e. copyright statements, footer menu etc goes in here
index.php, this file is used by default for list of blogs, but you can change it from settings > reading > and then choose the page you want to show as home page.
front-page.php, this is similar to what index.php does but it has more priority. So if both the files are present then this will be used. Another advantage of front-page.php is that you can add any kind of hardcoded html in here as it is not used by any other page.
page.php, this file is used to show all content of wordpress pages, like about, contact etc.
single.php, this file is responsible for showing a single blog post.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I am developing a wordpress website and I would like to have two instances of the website, one in english and the other in german. My goal is to when a user visits my website, the user is redirected to the correct language, based on his/her browser language. But I want to do this with only one instalation of wordpress. I can make duplicates of the pages (one in english and other in german), make a homepage duplicate by setting the homepage as a template for pages. My issue is the menu. How do I set different menus to different pages?
You'll need to register a new navigation menu, and add it to the templates you are using for the German pages, then make a new header template, then set your templates to use that new header. Here's the steps needed to do this:
Register the menu
In your theme's functions.php, you'll need to add some code like this at the end of the file:
function register_german_menu() {
register_nav_menu('german_menu',__( 'German Menu' ));
}
add_action( 'init', 'register_german_menu' );
What this does is tells Wordpress that you want to add a new location for a menu to be customised in the Appearance > Menus page. You should from now be able to add items to your menu, but they won't show up anywhere yet.
Create some page templates
You will have to create a set of page templates for the German half of the site. You will need a new page.php and a new header.php template. I would recommend calling these page-german.php and header-german.php respectively. For your page-german.php, copy paste the page.php template into page-german.php, and add this comment at the top of page-german.php:
<?php /* Template Name: German Page Template */ ?>
This tells WordPress to recognise it as a page template, and tells it it's name. This makes the template selectable on each individual page.
Now, you need to make a header template. Copy paste the header.php template into the header-german.php. In this new template, look for a line that looks something like
wp_nav_menu(array('theme_location'=>'something'))
And change it to:
wp_nav_menu(array('theme_location'=>'german_menu'))
This will display the German menu instead of the regular menu.
Now, go back to page-german.php and look for the line that looks like:
<?php get_header(); ?>
And change it to:
<?php get_header('german'); ?>
This tells Wordpress that on this page, you want to use the header-german.php file to generate the header rather than header.php.
Setting up page templates and Menus
First, go to the Appearance > Menus tab, and create a new menu, then assign that new menu to the slot "German Menu". Then, you will need to go through all the German pages of your site, and in the right sidebar when editing, set the page template to "German Page Template". Now your pages using the new template will display the German menu instead of the English one!
Further?
If you have other templates that need converting, then you can convert them as described above, by making a copy and changing the get_header() call. I didn't really expect this answer to be this long but I hope it helps!
You can use a plugin like WPML to achieve this but if you dont want to use a plugin, you can edit header.php and add a condition on which menu to load depending on the browser language.
e.g.
<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
case "en":
//display english menu
break;
case "de":
//display german menu
break;
default:
//default to english or german menu
break;
}
?>
Above code was taken from: Detect Browser Language in PHP
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
What i have
I have a wordpress hosting website.
Wordpress admin information.
FTP details
What i do
I have create html website and upload it in ftp.
What i need to do?
I have to launch my wordpress hosting website using those html pages website uploaded in ftp.
So please tell me how to set theme and configure my wp-admin dashbord so i can use my html pages as website.
EDIT: Question is on Hold. But i get a working solution
Step 1) Open Ftp
Step 2) Delete all files with folder like www public_html
Step 3) make your default page as index.html
Step 4) It will know work as a default website
Step 5) Open Your website in browser now you can see your static html page there
To do that you need to set up your own Wordpress Theme. I suggest using one of the starter themes. I've had the most success with http://underscores.me/
The idea is to modify the underscores theme you just downloaded (which has almost nothing in it) so that, when you open a page in your WP website, it shows nothing at all (not even the title, menus, sidebar, nor the post content). The general guideline is this:
1. Study the .php files in the underscores theme you just downloaded. Try to modify the PHP code so that you end up with files that show nothing when loaded by WordPress but still work without an error. This is mainly your header.php and footer.php file, your page.php file, and post.php. I might be missing some, just check all of them.
2. Embed your HTML code into the PHP files of your theme. What's of interest to you is to embed your header and footer in header.php and footer.php. This will load your header and footer on any of your pages but leave the middle section (your content) blank.
3. Create new pages from the WP Dashboard so that they're loaded dynamically alongside your header and footer (and whatever else you added). When you create a page, just copy your HTML content into the page's content (make sure to tick the "Text" tab and not the "Visual" tab in the WP Editor). Your website will load just like your pure-HTML one did but dynamically and in a WP environment.
Hope that was helpful. I know this is not the cleanest way to do it. But you'll learn in the process.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Given a Wordpress permalink (or slug), is there a way to track backwards to figure out the code that generates the displayed page? For example, using this URL "my.domain.com/product-category/lamps/" or "my.domain.com/product-category/tables/" can you track the code used to make up the page that is displayed in the browser?
Basically, here is my problem. I've been hired to complete/fix a Wordpress site that was heavily, heavily modified by the original programmer (who quit and is not available to help). The site uses the Stylo Theme with WooCommerce. The code to build the product catalog pages has been modified and I'm having a hard time finding all the PHP functions that do these modifications. There are no pages in the control panel that have a permalink that corresponds to the URL (shown above); so I don't even know what template he has used to start these pages. He did not write a widget or plugin to make these changes, but changed the original code. His modifications broke (or deliberately disabled) some of the search functionality (min and max price range) built into the theme.
So, back to my question - given the final permalink displayed in the browser's address bar, can I backtrack the code 'path' used to build the page?
This is an easy way to get the path of the template file that is used to render the current request. Place the code in functions.php in your theme or in a plugin and this will print the path on top of your site.
add_filter ( 'template_include', 'debug_template_dump' );
function debug_template_dump( $template_path ) {
echo $template_path;
return $template_path;
}
In my experience in similar circumstances, the easiest way to proceed is this:
1. Log in to the site. Make sure you have the wordpress admin bar enabled.
2. View the page in question from the front end.
3. Select 'edit post' or 'edit page' or whatever is offered
The link you supplied is likely to be for a woocommerce product category. Customization was probably performed either using templates (look for a woocommerce folder in your theme) or by utilizing hooks to add custom functions (look in functions.php).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am a rails programmer basically who is looking to move towards wordpress for a project which involves conversion of paper based magazine / newspaper to an online version. I have developed rails app with HTML themes before and understand the HTML themes basically are concerned with front end logic. How wordpress themes are in that respect?? They are a bit expensive but do they have any back end functionality as well. I need some help understanding if i am thinking in the right manner. The theme has homepage which has multiple posts from multiple categories. Will i be able to put post with some categories and they will automatically appear as they shown in the homepage or do i have to manually select which post goes where. Regards
Each post in WP can be tagged and categorized. The posts can then be pulled from the database by various criteria - author, category, tag, date etc.
Read more here : http://codex.wordpress.org/Class_Reference/WP_Query
You could assign various columns on your homepage to display posts from different categories.
There are also different kinds of posts (post formats) such as image, video, quote etc. - which could all be displayed differently, depending on the theme (template).
Posts, post formats, categories, tags - all of these are a part of the standard WordPress install and are independent from the theme. The theme simply takes advantage of these features.
Wordpress is essentially just like any other CMS. You can make it do pretty much anything you want it to do. If you want all the posts to display on the homepage, you can. If you only want specific posts to display you can do that too with either categories or tags. All you need to know is some PHP and check out the Wordpress Codex for all the functions available.
If you are just wanting to buy a theme then obviously don't get the flexibility unless you hack the theme a bit.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How can I to create a custom page in Wordpress 3.0. Give me any link of tutorial.
WordPress provides a clever way to do this called Custom Page Templates. To create a WordPress Page Template, you’ll need to use your text editor. Go to the directory on your server where you installed WordPress, and then navigate to the directory of your theme. Usually that looks something like this: “/wp-content/themes/default” where “default” is your theme name.
That’s where you will create your custom page template file. Create a file called “cover_page.php” and add the following code to it:
<?php
/*
Template Name: Cover Page
*/
?>
<?php get_header(); ?>
Here's my cover page!
<?php get_footer(); ?>
more details read this
http://www.expand2web.com/blog/custom-page-template-wordpress/
To add to the answers above, one good way is to open a text editor (I like notepad++) and copy and paste the content of the page.php file into a new file, including the php template name code in one of the previous examples.
Call it something unique (like custom_page1.php ) and upload this file via ftp to your active theme folder inside your wordpress install on your server. You can use filezilla for this or another FTP program.
Refresh your editor page in wordpress and you should see your template listed with the others on the right.
Now when you publish a page you can choose this template from the dropdown menu on the side panel.
You can use the Page Template feature of wordpress to create a custom page.
First create page using pages->add new.Then,give title (for e.g. aboutus). Then click
Publish on right side of the window(no content is needed for the custom page).
Then,on left side of window click Appearance->Menus.
In menus window,on left side you will see Pages heading,in that click Most Recent and
check aboutus page. Then it will be shown on right side window.
Then,on left above Pages heading, you will see Custom Links, in that enter # in URL textbox
and aboutus in Label textbox. Then click Add to Menu button.
Done. You will see the menu as custom on right side of the window and then click save menu
button at the bottom right.
Then to check, on left top of the window click the website or your blog name. You will see
the menu. Click on it. No changes will occur.
That's it, done!
Here are some plugins you can use while creating what you need then you can turn them off or remove them.
http://wordpress.org/extend/plugins/theme-file-duplicator/
http://wordpress.org/extend/plugins/theme-file-maker/
Very easy way to do what you need.
This is a very simple part of WordPress theme development, I suggest giving the documentation (the WordPress Codex) a good read before going any further. There are also a tonne of great WordPress tutorial sites out there that will get you heading in the right direction.