- Last post
- 26 Responses
i cannot codding properly so please to help
Is there any way of adapting html pages into Wordpress without chopping them up to fit the content/sidebar structure? I'm trying to put a pretty straightforward site together(for a charity, so no money) and while building it in html is pretty straightforward, trying to make it work in WP is doing my head in.
I was hoping to import the static html pages as they are, and just use the bloggy bit of WP for news items. But WP isn't playing nice, mainly I suspect as I'm trying to circumvent the database element.
I've split out the "header.php" and "footer.php" and I can get it to build the home page by simply recreating the content of "index.html" in "home.php". But why won't it let me do this for other pages (say donate.php)?
Is there a way round this?
Just check which template file is being called and look at what is in the file (i.e. donate.php or whatever it is). Wwhatever code is contained in that file is what will be displayed.
The problem may be that donate.php is not actually linked to the page you are loading. Unless a specific template is selected for each page, it will display page.php by default.
this is what i don't understand. i've taken the content from "donate.html" and made a file called "donate.php" that calls "header.php" then has the html content, then calls "footer.php"
But if I try to access that page "http://localhost/wordpress/dona...
I just get a 404
OK I see your problem...WordPress doesn't call the PHP templates directly, if it did it wouldn't be much of a CMS would it? What you want to do is, in your donate.php file, add some text at the top of the file like this:
<?php /* Template Name: Donate */ ?>
Then go into the WordPress admin and create a page, and for that page select the template "Donate." When you view the page, it should contain whatever is in the donate.php file.
- by god, that works! cheershans_glib
- though it's not very handy if anyone but me wants to edit it.hans_glib
- That's where Custom fields come in. Replace the static content in the layout file with custom field calls and register those custom fields to that page layout.orrinward2
- custom fields to the page layout, then people can edit the content by editing that page.orrinward2
Cheers for that, though I guess I'll have to make a new template for very page... clunky.
Next question - the content area for all the other pages has a main column div and a side column div. The text in both columns changes from page to page - is there a way of setting up a template for this? The page creation in WP seems to allow for only a single column - if I paste the html into the "create page" text area, it just comes out as a single column...
Well you shouldn't need to make a different template for every page unless the design is different. Usually you would include some code like this to pull the content of your page:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
It's true that they don't give you a place to enter sidebar content for each page. You would have to use a plugin to add that kind of functionality. Something like this would work: http://wordpress.org/plugins/adv…
- that's what i thought - thanks for all your help. it seems a shame something so simple is so hard to do in WPhans_glib
- Yeah I guess the typical WP model is to have the same sidebar on every page.ukit2
- gawd, that plugin is for serious codeheads... way beyond me I fearhans_glib
ukit2 you are a genius - thank you so much.
amazingly i managed to get the plugin to work - sorted!
qbn to the rescue again
By default the posts function will bring up the content for the page itself rather than the actual posts.
In order for it to display the posts...you will need to go to Settings > Reading and where it says Posts Page select that page.
hey presto ukit, strikes again. I scoured t'interwebz looking for a basic how-to but they either are too simple or too complex.
thank you sir.
You don't have to go through the <?php /* Template Name: Donate */ ?> and then select the template routine.
If you name a file page-xxxxx.php, then it will get used by default by any page titled xxxxx. So create page-donate.php, upload it, and that's your Donate page taken care of.
hopefully for the last time, but don't hold your breath...
I want to include post excerpts and thumbnails on the home page to look like this:
found some bits of code to get it to work (mostly) but it looks like this:
The image is starting below the headline, rather than at the same height, and the I want the second post headline to start after the first post image. The code I have is
Try floatin the image right.
yes but the problem is the thumbnail is supposed to go into the attachment-custom_thumb div, and it isn't. I don't understand the code to know why it's not happening
how is the output in the theme template? still like the one you posted above?
The problem is that WP is arranging the excerpt so:
<div class="thumbnail pic"></div>
<p> excerpt </p>
and i need it to arrange it like this:
<div class="thumbnail pic"></div>
<p> excerpt </p>
and I can't see anywhere in the coding that will allow this
sorry to keep on at this, but it's so frustrating!
please post the code in something like paste bin, code pen or jsfiddle, it's a lot easier for people to help, without having to retype everything.
the thing I see here is that you are using a technique to get image into the excerpts, but then you want them out of it.. Not the best approach.
I would use Advanced Custom Fields to create an Image Field and assign it to posts or whatever.. then just output it before that code you have above...