Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mr Crucial
Oct 28, 2005
What's new pussycat?
Is it possible to have custom pages generated, from database entries, on the fly based on the URL that someone is trying to visit?

So for example, if I have a database table with office details, I can browse to

domain.com/offices/newyork
or
domain.com/offices/london

and the page will display relevant names, addresses etc for that office?

I've been looking at various simple guides for creating page templates but they all seem to assume that the pages will be created manually from the template. I have hundreds and potentially thousands of entries that I'd like to handle this way so creating them manually would be a real pain in the neck.

Adbot
ADBOT LOVES YOU

Mr Crucial
Oct 28, 2005
What's new pussycat?

fuf posted:

Do you mean you already have a database of office details that you're trying to render somehow? WP probably isn't the best choice for that.

Sorry, could have been clearer. It's a pre-existing database. What I'd like to do is create a new table within the the WP database (or a new database if that's considered 'better'), import my data, then have some sort of post or page template that queries the database based on the URL.

I found this series of guides that does roughly what I'm on about, this technique allows you to treat the URL as a set of parameters, then plug those parameters into a query:

http://www.whatmarkdid.com/php/reading-custom-url-parameters-wordpress/

http://www.whatmarkdid.com/php/displaying-data-custom-table-wordpress/

http://www.whatmarkdid.com/php/displaying-child-records-custom-mysql-table-wordpress/

I'll try that and see if it works.

Mr Crucial
Oct 28, 2005
What's new pussycat?

kedo posted:

Why would you do that in WordPress? It doesn't sound like you want to use any of the functionality WordPress offers besides templating (sorta). I've got to believe there are better tools for the job.

Because this is to add functionality to an existing, active Wordpress site. I thought it might be easier to try and work within WordPress to do this rather than add something new and then have to integrate them somehow.

Mr Crucial
Oct 28, 2005
What's new pussycat?
Can someone please explain what I'm doing wrong with these URL rewrites? I'm not a web programmer by any stretch of the imagination so I'm well out of my depth. I've added some custom parameters that are tied to a page template that I put together, so that when I browse to:

domain.com/office/?area=yorkshire&city=leeds

I get some specific information pulled out of a database query about the Yorkshire > Leeds office. So far, so good.

What I'd like to do is have tidy URLs that look like this:

domain.com/office/yorkshire/leeds

That go to the exact same page. However, the following code (based on something I found here: http://itecsoftware.com/custom-url-parameter-rewrites-in-wordpress ) that I've added to my functions.php doesn't work - all I get is a 404 error when browsing to the tidy URLs:

code:
add_filter('rewrite_rules_array','add_rewrite_rules');

function add_rewrite_rules($aRules) {
	
	$aNewRules = array('^office/([^/]*)/([^/]*)/?' => 'index.php?pagename=office&area=$matches[1]&city=$matches[2]');
		
	$aRules = $aNewRules + $aRules;
	
	return $aRules;
}
Can anyone help? Most likely I've made a boneheaded mistake somewhere.

Mr Crucial
Oct 28, 2005
What's new pussycat?
I just added an SSL cert to my Wordpress site and redirected all traffic to HTTPS - and now none of my scheduled posts are firing. Every single one of them just sits at 'missed schedule'.

Anyone have any ideas as to why this would be happening, or even how I can start to troubleshoot? I don't know where to start.

Someone suggested to me that I set up a cron job to call wp-cron.php, which I've now done, and I'm just waiting for my next scheduled posts to drop later today to test. But this seems like a half-assed way of doing it.

Mr Crucial
Oct 28, 2005
What's new pussycat?

Scaramouche posted:

When you say redirected all traffic, did you make an .htaccess entry rewriting all http requests to https? Or just click the "force https" checkbox and changed the base url to use https?

I did both - updated .htaccess, updated the base URLs to point to the HTTPS version, plus I installed the CloudFlare SSL plugin since that's the SSL service I was using and without it the admin pages don't work properly. The scheduling was done using the built in Wordpress functionality, I didn't use a plugin for it.

I've had a look through various settings within the Wordpress files but I can't see anything that seems to point to a scheduler module pointing to any URL, let alone the HTTP address.

e: the cron job solution worked

Mr Crucial fucked around with this message at 15:54 on Oct 26, 2016

Adbot
ADBOT LOVES YOU

Mr Crucial
Oct 28, 2005
What's new pussycat?
Does anyone have a good suggestion for a plugin or other solution for managing a lot of photos, and displaying those photos on pots/pages with metadata? I have a lot of historical images that are often poor quality - black and white, grainy, blurry, indistinct. Having the right caption and other metadata displayed is pretty important.

At the moment I'm using Flickr as the backend CDN, because it's really good for managing these photos - the ability to have lots of albums, with the same photo in multiple albums, and lots of easy to use metadata including setting historical date/time for when it was taken. There's also something of a social aspect of this which has proven pretty good at driving some traffic to my site.

However I'm having a lot of trouble getting these images to display properly on my posts. I've been using the Slickr-Flickr plugin which is aimed at galleries rather than single pics and doesn't display any metadata other than the title from Flickr. It's also gone almost 2 years without an update. Direct Flickr embeds are a little better, but the JS used by these seem to be blocked by some adblockers so you get the photo with no supporting metadata, and if you have more than 3 photos per post (as I usually do) then something in the Flickr API likewise breaks with the same result. Also with the Yahoo/Verizon takeover I'm a little worried about the long term viability of Flickr.

I looked at the NextGen and Envira Gallery plugins but neither really solves this problem - they are pretty average as CDNs with limited ability to manage metadata and the options they have for displaying images are too limited for what I need.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply