miocene22
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Using the settings APIactually, just putting
$sa_settings = get_option('sa_options');
at the top of header.php is probably the best way isn’t it?Forum: Fixing WordPress
In reply to: Using the settings APIOK I’ve hit a stumbling block.
Most is working but I’m having trouble calling the options into the theme:
I’m storing all the options in an array under the database entry called sa_options.
In my functions.php I have defined the array
$sa_settings = get_option('sa_options');
to allow me to call the options onto any theme page.This mostly works but does not work for the header.php.
if I put
print_r ($sa_settings)
in header.php (within the actual body so I can actually read whatever is output on the page) nothing is output.
However, if I put the same function in index.php it prints the contents of the array.It seems as though wordpress calls header.php before defining $sa_settings (which is defined in functions.php). Any idea how to ensure the $sa_settings variable is defined inside header.php aside from putting it there?
Forum: Fixing WordPress
In reply to: Using the settings APIGreat thanks for the reply; I’m now getting somewhere.
Checking my database using phpmyadmin, I can see that it is now storing the options when I submit the form. This is having fixed my validation function as you described.
(I will implement some validation soon but I just want the concept to work first)i think you’ve answered all my problems for now, but I’ll be back if/when I stumble again.
Thanks again..
Forum: Fixing WordPress
In reply to: Using the settings APIThanks I have had a read over it but it is very long and complicated so I can’t find the specific bit I’m looking for.
Cna you explain how the fields in the form are put into the database. Because I don’t think
register_setting()
is getting the entries.Here is the html that my
sa_theme_options_page()
andsa_options_table()
generate: https://pastebin.com/NB2bTuWZForum: Fixing WordPress
In reply to: Using the settings APIOK sorry to keep bumping but I’m slowly picking up things:
The purpose of theregister_setting()
function is clearer to me now. I’m just not quite sure how to give it the values to store in the database.E.g. if I have the
$option_name
parameter (parameter 2) set to sa_options I have then, in my form, set one of my text fields to havename="sa_options[sa_headerfontsize]"
.
Am I right in thinking thatregister_setting()
should save whatever in typed in the text field in the sa_options array as so?:
sa_options["sa_headerfontsize"] = "whatever is typed";
I tried this but using phpmyadmin, there is a “sa_options” database entry in the wp_options table but it doesn’t have anything in it.
Forum: Fixing WordPress
In reply to: Using the settings APIOK I’ve fixed the huge options page from coming up by adding
<?php settings_fields( 'sa_theme_options' ); ?>
but my problem lies with storing the options in the database.I borrowed some code on this page that I believe stores all the options in one database entry in the form of an array.
Meanwhile, my options page assigns an id to each option with the intention of storing each option as 1 database entry.
Just not sure how to sort this out…
Forum: Fixing WordPress
In reply to: Visual Editor not working on 3.1.2Did you say you tried a fresh wordpress install? If so it suggests an issue with the webserver. It might be worth taking it up with however manages the webserver.
It seems really odd that it’s not working as problems with the visual editor often mean a jquery problem which is usually fixed by uninstalling plugins, checking functions.php etc.
Forum: Fixing WordPress
In reply to: Is there a plugin for this?I might be. If you let me know your website and tell me your requirements in detail I’ll let you know what I can do.
Forum: Fixing WordPress
In reply to: Visual Editor not working on 3.1.2Try changing the theme.
If it works after changing the theme it suggest a problem in the theme’s functions.php file. Most likely to do with enqueing the jquery script.Forum: Fixing WordPress
In reply to: Is there a plugin for this?You would have to write some code to make this happen.
Firstly you should add you hotel listings as posts.I would suggest either using the custom post fields or post categories to add a place name/location to each hotel listing. Also add a post thumbnail to each listing (https://codex.www.ads-software.com/Post_Thumbnails)
Then write a custom query to call posts belonging to a given category (see https://codex.www.ads-software.com/Function_Reference/query_posts):
$args=array( 'posts_per_page' => $ppp, 'meta_key' => '_thumbnail_id', 'category_name' => 'Spain' ); //this query will return $ppp posts which have a thumbnail set and are in the "spain" category query_posts($args); ?> <?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); //add the appropriate html here endwhile; endif; wp_reset_query(); ?>
This code would go in a page template that would be assigned to location pages. You would then apply a javascript image slider to turn the html into a nice slider (e.g. https://sorgalla.com/jcarousel/)
Reasonable php, html, css and javascript may be needed to do this.
Forum: Fixing WordPress
In reply to: Post Title Below Content…The image might be called using the_post_thumbnail(). If you move the_title() below that it might work.
If the image is just part of the body of the post then it’s more tricky. One way, if the images are always the same height would be to use css to fore the title down. Not the best method though.
A better way would be to add post image support to the theme and call post images as mentioned above: https://codex.www.ads-software.com/Post_Thumbnails
Forum: Fixing WordPress
In reply to: problem solved admin please deleteHow are you uploading it? Are you using an ftp client?
The easiest way to install a plugin like wp e-commerce is just to login into your wp control panel and select plugins->add new. Search for it and click install.
Wordpress will install it automatically.Forum: Fixing WordPress
In reply to: Feedburner feedsAny ideas?
What’s weird is that sometimes Firefox goes to the feedburner page and sometimes it just shows the feed in the built-in reader.
Any explanation??
Forum: Fixing WordPress
In reply to: Exporting whole wordpress site including imagesAll the images were hosted on the old site in the wp-content folder. There’s no obvious reason why they failed.
I sense a bit of a task manually recovering the missed ones.
Forum: Fixing WordPress
In reply to: Exporting whole wordpress site including imagesIt kinda worked! Images were successfully imported for some posts but failed for others.
Any ideas what the best way to recover the missed images are?