simple html site to wordpress and edit visually - wordpress

I am converting a very simple html site to WordPress. I made a very simple folder like,
custom_theme
header.php
front-page.php
about.php
footer.php
I cut all the code from index.html and spared them into header,footer,front-page,about.
then in the wp dash board i created those page and select the template. The site is working fine.This is the live site
http://www.mannmechanicalhvac.com/
Now i want to edit the content and image from wordpress visually not from code. Is their any possibility to do that?
###thanks in advance.

A very basic example:
<?php while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<div class="page-content"><?php the_content(); ?></div>
<?php endwhile; ?>
the_content() outputs the content which was entered in the editor.
This is a good starter theme: _s from Automattic
or: http://underscores.me/
Recommend to read:
Stepping_into_Templates
Theme_Development
Template_Tags
template-hierarchy
The_Loop

Related

Wordpress showing post info under new pages, but I want it to show only under new posts

I have basic loop to show PHP posts
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="post">
<h2><?php the_title(); ?></h2>
<div class="post-info"><?php echo get_the_date(); ?> - posted by <?php echo get_the_author(); ?> </a></div>
<?php the_content('<button class="show-more">Saznajte više</button>'); ?>
</div>
<?php
endwhile;
else :
echo "<p>No posts</p>";
endif;
It is the line that has <div class="post-info...
Now it is working very well, it shows date and author under post heading, but it also shows that when a new page is created. I understand Wordpress works like blog and it is natural for it to treat new pages as posts, however I want to avoid that behavior. I only want it to be shown under post headings, but not under new page headings. What would you suggest me?
https://developer.wordpress.org/themes/basics/template-hierarchy/
Check this template hierarchy and you'll understand how WordPress call template files.
Basically, WordPress firstly runs index.php and then call different template files. Since you only have index.php, so when rendering pages it all also falls back to index.php.
What you can do is creating a page.php with its own design for WordPress to call properly.

Page layout (page.php) doesn't apply to pages

I made few pages in my admin panel. Then created page.php with this code inside
`<?php get_header(); ?>
<section>
<?php if (have_posts()): while (have_posts()): the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</section>
<?php get_footer(); ?>`
Set one of this pages as "homepage". And when i open site it shows me header, footer... everything it should, but when i try to open any of the other pages, I get 404 page...
Help me please, where i have to search for mistakes?
Thank you
You need to define one of the following: index.php (REQUIRED), home.php, or front-page.php.
Here's the way template inheritance works for the home page:
WordPress looks for front-page.php, regardless of whether or not your site is set up to show a static front page, or your most recent posts
If front-page.php doesn't exist, WordPress looks for home.php
If no home.php is set, WordPress defaults to index.php
You can read more about template inheritance in the codex.

how to display recent 5 posts from wordpress site to magento

I'm having magento ecommerce website & wordpress blog site. I want to display recent 5 blog posts in my magento homepage. I tried with below codes
// Get the last 3 posts.
<?php
require('/the/path/to/your/wp-blog-header.php');
?>
<?php query_posts('showposts=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?><br />
<?php endwhile;?>
I copied this file in new .phtml file and i called that file to homepage. But after doing this my homepage is showing only header & breedcrumbs...
Any solution for this problem is appreciated......
Don't integrate on the php side, use the rss feed with a feed reader such as http://www.magentocommerce.com/magento-connect/flagbit-feed-reader.html

Category Images Only Displaying Once on Special Recent Posts (WordPress)

I am using WordPress to put together a blog. I am using the Category Image(s) plugin to put an image for each category above the posts.
The main page is laid out as a big image and excerpt for each article and when you click on it, it takes you to the full article (I am using the 'Special Recent Posts' plugin for this). I want category image headers above each big image/excerpt.
Everything works fine for the first article but after that I get no headers. The reason is because the code I have in my header is calling the 'Category Image(s)' php function, which works. Then it calls the 'Special Recent Posts' php function which in effect runs the loop to grab the first five most recent articles. It doesn't run the category images function every time for every article, only the first time.
Here's the code:
<?php get_header(); ?>
<?php c2c_the_category_image($image_extensions='png gif jpg', $image_dir='/wp-content/images/', $use_name_if_no_image=true, $start_from='begin', $limit=999); ?>
<?php echo do_shortcode("[srp srp_number_post_option='5' srp_thumbnail_option='yes' srp_widget_title_hide_option='yes' srp_post_date_option='no' srp_wdg_excerpt_length='50' srp_wdg_excerpt_length_mode='fullexcerpt']"); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
How can I get it to run the category images function for all the recent posts? Thanks for the help.
EDIT:
I attempting to go into the PHP of the Special Recent Posts plugin but when I attempted to enter the category images code in, it created some critical errors. I'm looking for the easiest solution if it's out there (I know this isn't a very simple question to start with). Any help? (I've placed a bounty)
Your way of doing things is extremely complicated and convoluted.
The simplest way that is proved to work is by having images that correspond with either category ID or category slug!
http://baldino.rs/collection
As you can see, this is a page that lists all the categories with their images and descriptions.
I'm having little trouble understading if you want:
To have a category image above every post
To have a category image AND post image above every post
I'll demonstrate the first solution below
Here is the order in which we will create the blog page:
Name the category images either by slug, or by ID (i recommend ID)
Upload the images to the server - prefferably to the images folder of the theme
Create our custom loop which will display our category image, category name, post title and excerpt
So the index page (blog page) should look something like this
<?php get_header();?>
<div id=:content">
<div id="posts">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php
$category = get_the_category();?>
<img src="<?php bloginfo('template_directory'); ?>/images/<?php echo $category[0]->term_id;?>.jpg"/>
<h3 class="cat-title"><?php echo $category[0]->cat_name;?></h3>
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content(); ?>
</div>
</div>
<?php endwhile;endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
You should really avoid plugins for the simple stuff that is easily solved by the loop
I recommend that you start reading the WP codex - http://codex.wordpress.org
Every function, class, reference is documented in detail and it's very easy to understand.
If you have more questions, do not hesitate to ask

Wordpress Latest Blog Entries Plugin for Website

I would like to display my blog entries on my website in an iframe or whatever suggested method is. Can somebody please advice how to do that?
Thanks in advance.
Hi,
There are multiple options to do this I am mentioning three of them:
Menthod # 1
You can create a page template in wordpress and than using that page template create a page. Now you have the URL you can use that page in iFrame on any website.
Method # 2
Create a file at the root level of the server with this code:
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('wp-load.php');
query_posts('showposts=1');
while (have_posts()): the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<p>Read more...</p>
<?php endwhile; ?>
Now you can call this file in the iFrame and you have the latest posts.
Method # 3
You can use the rss feed from wordpress and either use PHP or jQuery to style it.
Thanks
Peachlabs

Resources