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
thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

Heskie posted:

Nice, what sort of things are you using it for?

So my initial use was putting wordpress posts onto facebook pages. Saving customers repeating effort. The gmail contacts to google docs spreadsheet is also worth using! I love it and can see it being bought for lots of money at some stage.

Adbot
ADBOT LOVES YOU

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
So I am happy, well as I ever will be, with the curtains splash page thing. The next question is how to make people who are revisiting the site skip it and go to the homepage. Any ideas?

spiritual bypass
Feb 19, 2008

Grimey Drawer
Set a cookie and skip the animation if it's there?

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

rt4 posted:

Set a cookie and skip the animation if it's there?

Yeah I have no experience of cookies or how to implement that into my wordpress site.

Bradzor
Mar 18, 2007
Fwhaa?

thegasman2000 posted:

Yeah I have no experience of cookies or how to implement that into my wordpress site.

This should do it for you:
php:
<?php
if( ! $_COOKIE'saw_animation' ] ) {
    showAnimation();
    setcookie'saw_animation'trueYEAR_IN_SECONDS );
} else {
    skipAnimation();
}

Disharmony
Dec 29, 2000

Like a hundred crippled horses lying crumpled on the ground

Begging for a rifle to come and put them down
I just finished installing Wordpress for 2 other projects I plan to do and everything seems to be working fine except when I log on to wp-admin and see this unstyled crap:



When you click on any other link from there it loads an empty page. This has probably been answered hundreds of times already I just don't know what search query to use on Google exactly so hopefully I can get a quick answer from the experts.

thegasman2000 posted:

If it has an RSS feed then use ifttt. Since being linked to it earlier itt it's changed my workflow a lot!!!

Good find! I'll go and use that if ever I figure out how to extract the RSS :)

The Dreamer
Oct 15, 2013

Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn

Disharmony posted:

I just finished installing Wordpress for 2 other projects I plan to do and everything seems to be working fine except when I log on to wp-admin and see this unstyled crap:



When you click on any other link from there it loads an empty page. This has probably been answered hundreds of times already I just don't know what search query to use on Google exactly so hopefully I can get a quick answer from the experts.


Good find! I'll go and use that if ever I figure out how to extract the RSS :)

Did you install it on a site or server that already had an index.php page on it? I remember seeing something similar when I moved one of my wordpress projects to a live web server. I'd forgotten to delete the index.php that was already in site directory.

grenada
Apr 20, 2013
Relax.
How would I embed adsense ads into posts? Any good plugins or tutorials?

edit: nvm found my answer here: http://www.wpbeginner.com/wp-tutorials/how-to-insert-ads-within-your-post-content-in-wordpress/

grenada fucked around with this message at 02:22 on Sep 8, 2014

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

Bradzor posted:

This should do it for you:
php:
<?php
if( ! $_COOKIE'saw_animation' ] ) {
    showAnimation();
    setcookie'saw_animation'trueYEAR_IN_SECONDS );
} else {
    skipAnimation();
}


So I put this in the page template. And it doesn't show the animation for me, which it shouldn't, but doesn't forward me to the normal homepage. Just a white screen.

In the code above do I need to reference the actual function name I am using in the script?

Here is my page as it is.

http://reddragondramatics.com/

The page it should redirect to is/home

What a ball ache but I can't allow it to run every time you visit it! :cripes:

my bony fealty
Oct 1, 2008

Disregard this post, I figured out how to make my script work!

my bony fealty fucked around with this message at 19:52 on Sep 9, 2014

rugbert
Mar 26, 2003
yea, fuck you
Where did the "sticky" post option go? It's no longer under "visibility".

streetlamp
May 7, 2007

Danny likes his party hat
He does not like his banana hat
Not here under the Publish tab to the right -> Visibility? (4.0 screenshot)

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.

thegasman2000 posted:

So I put this in the page template. [..] doesn't show the animation for me, [..] doesn't forward me to the normal homepage. Just a white screen.

In the code above do I need to reference the actual function name I am using in the script?

Yeah, something like that. What you're seeing (white screen) is probably a PHP error, but with "display_errors" turned off. Switch them on (wp_config.php?) and you should see it say something like "undefined function showAnimation".

You probably want something like this in your template for the "/" page (and only that page):

php:
<?
// Cookie set? Skip animated landing page
$pageSeen = isset($_COOKIE[ 'saw_animation' ]);
setcookie( 'saw_animation', true, YEAR_IN_SECONDS );
if( $pageSeen ) {
    header('Location: /home');
}
?>
There's a function for Wordpress which lets you redirect to a page specified by ID, so if you change the path of the page it keeps the same reference, but I can't remember what it is.

I changed the layout of the code to remove a bug where every year you re-visit the page the cookie will have expired and you'll see the landing page again. Now every time you pass through the landing page it will update the expiry date on the cookie and you shouldn't see it ever again.

Hopefully know this and are ignoring it for some requirement, but splash pages are generally frowned upon these days as they create a needless extra step for users and no content for search engines to crawl, which leads to weird results.
Also your page layout wigs out (see scroll bar) at <1024px.

rugbert
Mar 26, 2003
yea, fuck you

streetlamp posted:

Not here under the Publish tab to the right -> Visibility? (4.0 screenshot)



Nope, I'm on WP 4.0 and using the twenty fourteen theme just to be sure. I created about 25 posts using some dummy content creator and went to edit one and this is what I see:

Robot Arms
Sep 19, 2008

R!
Could it have to do with the post type? From the Codex:

quote:

Please notice that this feature is only available for the built-in post type post and not for custom post types.

I know I still have the option after upgrading to 4.0.

rugbert
Mar 26, 2003
yea, fuck you

samglover posted:

Could it have to do with the post type? From the Codex:


I know I still have the option after upgrading to 4.0.

OK so. I just dumped my DB and now the option is there. Then I activated my new theme and its there as well. I've been messing with roles and capabilities, could it be that? I've noticed that some capabilities have unexpected effects. For example, if a role doesn't have "edit_posts" enabled then they can't assign categories to a post. Or if you have a custom post, with a custom taxonomy, the role would not be able to assign the taxonomy to a custom post even if said user as edit_CUSTOMPOST enabled.

edit - confirmed. It was a capability issue.

rugbert fucked around with this message at 20:59 on Sep 12, 2014

Mayostard
Apr 21, 2007

In the Chamber of Understanding
Edit: Nevermind

Mayostard fucked around with this message at 21:00 on Sep 12, 2014

rugbert
Mar 26, 2003
yea, fuck you

Mayostard posted:

What would be the best option for basically designing a site offline, is it even possible? Please excuse my noob question.

if you're using a mac, download MAMP (which I think comes with SQL Pro, if not get that too). Linux users should just set up LAMP through tasksel. Windows users have WAMP as an option.

the "AMP" in all those packages stand for Apache, MySQL, and PHP which are all the things you need for WP development.

streetlamp
May 7, 2007

Danny likes his party hat
He does not like his banana hat

Mayostard posted:

What would be the best option for basically designing a site offline, is it even possible? Please excuse my noob question.

What OS? But yes 400% possible, web development should happen locally and be deployed to publicly accessible servers when complete.

Mayostard
Apr 21, 2007

In the Chamber of Understanding
Thanks, guys!

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

I'm having a really obnoxious problem when I deploy my site to production. I bet this is common. Since the "Site URL" setting has been set to "localhost" throughout development, it remains that way after I copy the database over to production. The result is the production site pointing to localhost, which makes it impossible to log in to change the setting (because as soon as I log in I'm back in test). If I change the setting before deployment, the prod site works, but the test site points to production! It becomes an annoying catch-22. My solution has been to alter the setting in the database via PHPMyAdmin, but surely there's something simple I'm overlooking?

e: the setting is actually called "Site Address (URL)", under General Settings.

Spatulater bro! fucked around with this message at 22:12 on Sep 12, 2014

Weird Uncle Dave
Sep 2, 2003

I could do this all day.

Buglord
I've been using WP CLI for things like that. A command like "wp search-replace localhost your.domain.here" will not only update the Site URL, but also a bunch of other places where the site name often lurks in the database.

(I use it more for moving sites between test/stage/production environments, but it's the same principle.)

Edit: You may also want to do "wp search-replace 127.0.0.1 your.domain.here" just to be safe. One of my devs, and I use the term somewhat loosely, somehow manages to have both of those in her databases, in different spots.

Weird Uncle Dave fucked around with this message at 23:00 on Sep 12, 2014

streetlamp
May 7, 2007

Danny likes his party hat
He does not like his banana hat
I've used wp-cli for it and also this tool https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Chris!
Dec 2, 2004

E
I work in localhost, then use the Duplicator plugin to move the site to a production server - that plugin automatically fixes and changes permalinks etc to point to the new site address (and makes everything very easy).

kedo
Nov 27, 2007

wp_query question.

I have a wp_query running that's looking for custom posts that have specific categories. There are 10 total custom posts, 7 of which have the categories I'm looking for. However when I echo $wp_query->found_posts onto the page it's returning the total number of custom posts (10) instead of the number it's actually displaying (7). I get the feeling it's because I'm declaring $paged before the query is run, so it's simply looking at all of the posts rather than those returned by the query, but I'm unsure if that's true or how to rewrite this.

Any point me in the right direction?

PHP code:
<?php 
$results = explode(",", "75,76,63,26,30,77,")
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
  'category__in' => $results,
  'post_type' => 'special-features',
  'post_parent' => 0,
  'posts_per_page' => 5,
  'paged' => $paged,
);
$the_query = new WP_Query( $args );

if ($the_query->have_posts()): ?>
  Total posts <?php echo $wp_query->found_posts; // Returns 10 instead of 7 ?>
<?php 
  // Rest of the loop happens here
?>
e: I ended up solving this with a bit of a workaround. Turns out that found_posts returns the total number of posts regardless of category (or something, it's surprisingly poorly documented). So instead of echoing its value into the page I'm simply doing a get_posts() and counting the results. Seems silly to me, but it works.

PHP code:
<?php
$countArgs = array(
  'category__in' => $results,
  'post_type' => 'special-features',
  'post_status' => 'publish',
  'showposts' => -1
);
$totalPostCount = count(get_posts($countArgs));
?>

Total posts <?php echo $totalPostCount; ?>

kedo fucked around with this message at 20:06 on Sep 19, 2014

Robot Arms
Sep 19, 2008

R!
I've run into a problem. We're trying to distinguish between standard posts and other post formats. What I want is a link to Articles that goes to a list of just the standard posts, and a link to Notes that goes to a list of non-standard posts (links, quotes, videos, etc.).

My original idea was to do a page /articles and /notes. It's easy to do a custom query that gets just the post formats I want, but pages aren't paginated, so I only get one page of posts. Are pages the wrong thing to use? Is there another way to create a list based on post format?

fuf
Sep 12, 2004

haha

samglover posted:

I've run into a problem. We're trying to distinguish between standard posts and other post formats. What I want is a link to Articles that goes to a list of just the standard posts, and a link to Notes that goes to a list of non-standard posts (links, quotes, videos, etc.).

My original idea was to do a page /articles and /notes. It's easy to do a custom query that gets just the post formats I want, but pages aren't paginated, so I only get one page of posts. Are pages the wrong thing to use? Is there another way to create a list based on post format?

I think you can add pagination to any custom query.
Check here http://codex.wordpress.org/Pagination and look at the "Adding the "paged" parameter to a query" section

Robot Arms
Sep 19, 2008

R!
Thanks. I was looking at that last night, but I must have been too bleary-eyed to figure it out. It's working just fine now.

Robot Arms
Sep 19, 2008

R!
Is there a way to get an archive page for a particular post format? I've done it the hacky way, by creating a custom page template and filtering the query. I'm hoping to do something like you would do for tags, like:

lawyerist.com/tag/foo
lawyerist.com/format/aside

EDIT

Found a partial answer: http://codex.wordpress.org/Function_Reference/get_post_format_link

Basically, post formats are at lawyerist.com/type/aside (and so on).

Robot Arms fucked around with this message at 02:49 on Sep 18, 2014

Kobayashi
Aug 13, 2004

by Nyc_Tattoo
This is my first foray into Wordpress and I'm already about to throw the goddamn thing out the window. I want to serve Retina assets. I have images and their @2x variants. I searched for Retina plugins, tried all of them, and found that none of them work. I'm using Wordpress 4.0 on an AWS instance. If I had to guess, I'd say all these plugins are failing because Wordpress insists on renaming/obfuscating my images something like /wordpress/wp-content/uploads/100 instead of funny_hats@2x.jpg. I must be missing something blindly obvious. Please tell me I'm missing something obvious.

fuf
Sep 12, 2004

haha
You could just write your own css / js for displaying retina versions. You can put images directly in wp-content/uploads or wp-content/themes/your-theme/img and link to them directly.

slartibartfast
Nov 13, 2002
:toot:
Get the (free) Jetpack plugin and enable their (free) image CDN. It will auto-resize what you upload and serve Retina versions when needed.

Chris!
Dec 2, 2004

E
Hope someone can help - usually, when I need to move a WP site from one place to the other, I use the Duplicator plugin (or similar). However, I have a customer who needs to move a WP site without having access to his old WP itself - what he does have is a backup .tgz file which, when unpacked, includes the whole WP directory and files, plus a separate .sql backup of his database.

What would be the process to get this back online, onto a new, fresh host, with all the old data (there were tons of posts and uploads he wants to keep)? Can I just edit wp-config.php and copy the files to the server, create a database with the same name then import the database content later?

This is to the same domain as before, just totally new hosting. Will have to point the old domain to the new server.

Sorry if this is a silly question, I've just not had to do this before.

spiritual bypass
Feb 19, 2008

Grimey Drawer

Chris! posted:

What would be the process to get this back online, onto a new, fresh host, with all the old data (there were tons of posts and uploads he wants to keep)? Can I just edit wp-config.php and copy the files to the server, create a database with the same name then import the database content later?

  1. Copy the files to the new server
  2. Create an empty database and the user
  3. Import that database dump
  4. Install wp-cli
  5. Use wp-cli to search and replace the old filesystem path with the new one
  6. Use wp-cli to search and replace the old domain name with the new one if it's changed

Chris!
Dec 2, 2004

E

rt4 posted:

  1. Copy the files to the new server
  2. Create an empty database and the user
  3. Import that database dump
  4. Install wp-cli
  5. Use wp-cli to search and replace the old filesystem path with the new one
  6. Use wp-cli to search and replace the old domain name with the new one if it's changed

Hey, thank you for the reply. Doesn't sound too hard, hopefully!

spiritual bypass
Feb 19, 2008

Grimey Drawer
Nah, it's not hard. Post again if you get lost!

fuf
Sep 12, 2004

haha
So does that duplicator plugin need to be installed on both WP installs? And it'll copy the whole installation (db, theme, files, etc)? Sounds really useful. Any drawbacks?

And rt4's wp-cli search and replace method is in case you don't have access to the old install to install duplicator? What's the filesystem path you'd need to replace? Like /var/www/mysite with /var/www/mysite2? How come that path is even in the db? Can't it just base everything off the WP root directory?

questions :v:

Chris!
Dec 2, 2004

E

fuf posted:

So does that duplicator plugin need to be installed on both WP installs? And it'll copy the whole installation (db, theme, files, etc)? Sounds really useful. Any drawbacks?

And rt4's wp-cli search and replace method is in case you don't have access to the old install to install duplicator? What's the filesystem path you'd need to replace? Like /var/www/mysite with /var/www/mysite2? How come that path is even in the db? Can't it just base everything off the WP root directory?

questions :v:

With Duplicator, you don't need to install WP on the new server - you just run the plugin on the existing WP install, which produces a backup and an installer.php file, you copy these 2 files to the new server, set up the database (just make a new database and user), then go to installer.php and it installs Wordpress for you, with all the themes, files, db etc as they were on the previous install. It even changes permalinks etc for you. Here's a tutorial:

http://www.wpkube.com/move-backup-website-wordpress-duplicator-plugin/

It makes it pretty easy!

spiritual bypass
Feb 19, 2008

Grimey Drawer

fuf posted:

Like /var/www/mysite with /var/www/mysite2? How come that path is even in the db?

Yes, exactly like that.
As for why, Wordpress leaves me wondering that about a lot of things.

Adbot
ADBOT LOVES YOU

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

fuf posted:

And rt4's wp-cli search and replace method is in case you don't have access to the old install to install duplicator? What's the filesystem path you'd need to replace? Like /var/www/mysite with /var/www/mysite2? How come that path is even in the db? Can't it just base everything off the WP root directory?

Yes. You shouldn't need to replace to filesystem path.

Why you even need to specify the site url in the db is kind of beyond me, one of the most annoying parts about WordPress.

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