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
Bearnt!
Feb 6, 2004

No onions, no onions

Gyshall posted:

I have no idea but that code BBC formatting :allears:

Are you using some kind of custom theme? It looks like you might need a new function that uses $page_id instead of $post_id.

I thought that too because it made sense but it actually works on the pages section with $post_id as well after testing (not sure there is a $page_id variable in the codex). No custom theme, I'm able to get it working in multiple themes on different WP installs. Changing 'manage_edit-post_columns', 'manage_edit-post_sortable_columns', 'manage_posts_custom_column' all to page where post is gets it working on the pages section. I just can't simply duplicate the code and have one with post and one with page and have it work in both sections because it breaks the site. So I'm constrained with this code to only having it work on posts or pages and not both together. I'm guessing because the functions, actions and filters are named the same?

Adbot
ADBOT LOVES YOU

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
Yeah I think you'll have to create a new action/filter in a new function to do that.

I know I've done it before but can't find poo poo in my documentation =\

snagger
Aug 14, 2004

Bearnt! posted:

I thought that too because it made sense but it actually works on the pages section with $post_id as well after testing (not sure there is a $page_id variable in the codex). No custom theme, I'm able to get it working in multiple themes on different WP installs. Changing 'manage_edit-post_columns', 'manage_edit-post_sortable_columns', 'manage_posts_custom_column' all to page where post is gets it working on the pages section. I just can't simply duplicate the code and have one with post and one with page and have it work in both sections because it breaks the site. So I'm constrained with this code to only having it work on posts or pages and not both together. I'm guessing because the functions, actions and filters are named the same?

So changing your existing code's references from 'post' to 'page' works, but copying the functions and running both simultaneously breaks the site? What's the error from the PHP log?

slartibartfast
Nov 13, 2002
:toot:
Make sure you're not copy/pasting the functions. Each function should only exist once, but have two corresponding action hooks, like so:
php:
<?

add_filter( 'manage_edit-post_columns', 'aco_last_modified_admin_column' );
add_filter( 'manage_edit-page_columns', 'aco_last_modified_admin_column' );

// Create the last modified column
function aco_last_modified_admin_column( $columns ) {
$columns['modified-last'] =__( 'Last Updated', 'aco' );
return $columns;
}
?>
Double up your action hooks for each function (one for post and one for page) in your existing code like the example above and that should do it.

Weird Uncle Dave
Sep 2, 2003

I could do this all day.

Buglord
Anyone using HyperDB? I'm having issues with it not failing over as I'd expect, but I might just have unrealistic expectations.

I've got two database servers (masterdb and slavedb) in a boring standard master/slave configuration. HyperDB's db-config.php adds the master as read/write, and the slave as read-only.

As long as both servers are up, everything is fine, writes go to the master, reads are split between the master and slave. It's not really necessary, but it's fine that way. (I'm going for resilience, not speed.)

But as soon as I power down the masterdb, the site just stops responding. What I'd expect, is for the site still to be readable, just not allowing new comments/pages/posts/et cetera. Does HyperDB not work that way, and/or does WordPress not like it when there are no writable databases?

snagger
Aug 14, 2004
Anyone have a favorite modal/popup plugin? I'm looking for something very powerful - something that can pop up different modals based on different conditions (certain pages, is WooCommerce purchaser, etc.) and send users toward a variety of actions (email harvester, link to product X, etc.). Some built-in creatives are a plus. Would happily pay.

e: this is almost certainly OptinMonster; feel free to talk me out of it

snagger fucked around with this message at 21:59 on Feb 12, 2015

iwannabebobdylan
Jun 10, 2004
edit:Nothing to see here!

iwannabebobdylan fucked around with this message at 07:11 on Feb 13, 2015

fuf
Sep 12, 2004

haha
How busy does a site have to be before caching and minifying plugins like W3 Total Cache are worth it? Sometimes I work on sites that I know are only getting like 20 visitors a day, but they have these elaborate caching systems set up that make them a total hassle to work with. Is it legit to tell them to get rid of them?

kedo
Nov 27, 2007

fuf posted:

How busy does a site have to be before caching and minifying plugins like W3 Total Cache are worth it? Sometimes I work on sites that I know are only getting like 20 visitors a day, but they have these elaborate caching systems set up that make them a total hassle to work with. Is it legit to tell them to get rid of them?

A side benefit for plugins like W3 Total Cache is that they put less strain on a server. If these sites are on a crappy shared host and if they're doing lots of crazy PHP nonsense on every page load, W3 can speed things up a bit.

However you can probably make a good case for disabling them while you're working, at the very least.

fuf
Sep 12, 2004

haha
oh ok, yeah I guess it could make a difference even on really small sites.

I was getting pissed today because errors that I had fixed were reappearing when I re-enabled W3 Total Cache, even though I'd cleared all the caches. I had to delete the actual cache directory and reinstall the plugin in the end.

Chris!
Dec 2, 2004

E

fuf posted:

oh ok, yeah I guess it could make a difference even on really small sites.

I was getting pissed today because errors that I had fixed were reappearing when I re-enabled W3 Total Cache, even though I'd cleared all the caches. I had to delete the actual cache directory and reinstall the plugin in the end.

Also, even if the site only has 20 visitors, properly using caching and minification etc will give those 20 people a better and faster experience, and if the site's in your portfolio you'll look better to future potential clients :)

89
Feb 24, 2006

#worldchamps
I'm having some problems with some php code. I got a paid theme for my business website.

https://www.bearsdenpizza.net

Everything is fine except that the Live Music page is backwards in order and I can't figure out how to correct it and the creator of the theme can't figure it out either. At first when I got the theme, the slider showed everything in backwards order and showed expired events (just like this). I was able to glue together some php (I don't have any experience with it) that ended up working. The theme takes posts and sorts them by the publish date to spoof a calendar. As in, to make a future "event", I just set a future publish date and the theme grabs that and puts it on the main page calendar. Well, I want a page for the live music only, so I made a page that's just the Live Music category. But, it lists everything backwards and even lists expired events. Wouldn't altering code in my page.php or page-calendar.php maybe fix this?

Here's the page.php:

quote:

<?php

get_header();

//VAR SETUP
$eventCat = get_option('themolitor_events_category');

if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>

<div class="entry">
<h2 id="postTitle"><?php the_title(); ?><?php edit_post_link(' <small>✍</small>','',' '); ?></h2>
<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs();?>
<?php the_content(); ?>
<div class="clear"></div>
</div><!--end entry-->


<div id="commentsection">
<?php comments_template(); ?>
</div>

<div class="clear"></div>
</div><!--end post-->

<?php endwhile; endif; ?>

<?php get_sidebar();?>

<?php get_footer(); ?>

Here's the page-calendar.php:

quote:

<?php /*
Template Name: Calendar
*/

get_header();

//VAR SETUP
$eventCat = get_option('themolitor_events_category');
?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div <?php post_class(); ?>>

<div class="entry">
<h2 id="postTitle"><?php the_title(); ?><?php edit_post_link(' <small>✍</small>','',' '); ?></h2>
<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs();?>
<div id="twoColumns">
<?php the_content(); ?>
</div>
<div class="clear"></div>
</div><!--end entry-->

</div><!--end post-->
<div class="clear"></div>
<?php endwhile; endif; ?>


<?php
get_template_part('calendar');
get_footer();
?>

FCKGW
May 21, 2006

fuf posted:

oh ok, yeah I guess it could make a difference even on really small sites.

I was getting pissed today because errors that I had fixed were reappearing when I re-enabled W3 Total Cache, even though I'd cleared all the caches. I had to delete the actual cache directory and reinstall the plugin in the end.

I would also look at other caching software as well. I've had some serious headaches before with W3 on my busy sites and switching to something a bit simpler like QuickCache seemed to ease a lot of that pain.

snagger
Aug 14, 2004

89 posted:

events are backwards

For the page that lists your events, you'll need to use WP_query (http://codex.wordpress.org/Class_Reference/WP_Query) to construct a custom query that selects your desired posts and orders by the parameter and direction you want (http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters).

TheOtherContraGuy
Jul 4, 2007

brave skeleton sacrifice
I've been tasked with adding user account functionality to my company website, which is powered by WordPress. A user should be able to update their settings to manage which posts they will see. I have very little experience with WordPress so I'm really sure where to start. Does anyone have recommended plugins that would help with something like that?

kedo
Nov 27, 2007

Custom post type / Advanced Custom Fields question.

For ease of editing, I'm using custom post types for each of the main content sections on a site I'm working on. Most of the sections are collections of pages (eg. "About Us" type stuff) instead of collections of posts (eg. "News"). So for example, I'd like to make the content on the landing page for the About section easily editable by the client. Right now I just have a sub page in the About section named "About," but when someone accesses it the URL looks idiotic: foobar.com/about/about

Is there a way to either:

A) Have the About page within the About custom post type accessible by hitting foobar.com/about? I thought about doing some wp_query magic in the archive-about.php template, but worry that this wouldn't be a sustainable solution if the client wanted to add new sections.

B) Use ACF to give the admins the ability to edit content in one spot I can pull into the archive-about.php template? I know an options page would work for this, but I'd like to keep everything within the About section if I can.

snagger
Aug 14, 2004

TheOtherContraGuy posted:

I've been tasked with adding user account functionality to my company website, which is powered by WordPress. A user should be able to update their settings to manage which posts they will see. I have very little experience with WordPress so I'm really sure where to start. Does anyone have recommended plugins that would help with something like that?

There was a discussion earlier in the thread about users viewing multiple tags, something like:
http://www.myblog.com/tags/bluetag+greentag+redtag

I bet a user profile plugin could relatively easily save the collection of tags to the user's profile and default their home page to that feed of selected tags.

There may be a plugin out there that already does all this at once, but I didn't see it in a cursory Google search and Tidy Repo check.

snagger
Aug 14, 2004

kedo posted:

Custom post type / Advanced Custom Fields question.

For ease of editing, I'm using custom post types for each of the main content sections on a site I'm working on. Most of the sections are collections of pages (eg. "About Us" type stuff) instead of collections of posts (eg. "News"). So for example, I'd like to make the content on the landing page for the About section easily editable by the client. Right now I just have a sub page in the About section named "About," but when someone accesses it the URL looks idiotic: foobar.com/about/about

Why isn't the About section a single page?

kedo
Nov 27, 2007

snagger posted:

Why isn't the About section a single page?

Because there are multiple sub pages.

grenada
Apr 20, 2013
Relax.
Is there an easy way to disable the sidebar for mobile? I have a responsive theme but I don't like the way that the sidebar becomes stacked under the main page when viewed in mobile. Would look a lot cleaner without the sidebar present.

fuf
Sep 12, 2004

haha
It would depend on your theme. If you can work out how your theme's CSS handles media queries then you might be able to just add an extra rule to the narrow screen section like:
code:
#sidebar{
   display:none;
}
(but then you might also have to adjust your main content width etc.)

Robot Arms
Sep 19, 2008

R!
Any liveblog recommendations besides Automattic's plugin or 24LiveBlog? The Automattic plugin ate our liveblogs the last time we used it, and 24LiveBlog has become a crashy mess since the last update.

my bony fealty
Oct 1, 2008

I'm looking for some guidance in how to proceed with my current project -

I'm creating a conference schedule that uses a custom post type where each event is a post, and displays all the posts/events in a grid that shows the event title, presenter name, description, time, etc. I want to implement the ability for users to be able to "favorite" any individual event, which is then added to a dynamic list of their favorites. So they can look at the agenda grid, click a "favorite" button on an event, and then view their personalized list of favorites, which they can opt to save and view later at their leisure.

I am frankly pretty clueless on how to do this. Is it even possible without having to have people create accounts and be logged in? I don't know if the lists of favorites would have to be stored server-side, or if they could be stored in the user's browser cache, or what.

Anything to point me in the right direction would be greatly appreciated, or feel free to let me know if I'm dumb and this isn't possible. Thanks!

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
How in the world do professional WordPress dev shops keep a consistent development methodology?

If they're building a site for a client with multiple developers how do they keep everything in version control given WordPress's predilection for storing lots of stuff in the database?

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

Blinkz0rz posted:

If they're building a site for a client with multiple developers how do they keep everything in version control given WordPress's predilection for storing lots of stuff in the database?

Generally I keep a copy of the database in .sql form in the rep somewhere and update it every time I update the repo

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
Yo just a heads up to my homies in the Wordpress thread - the Yoast SEO plugin has a major vulnerability and you should update immediately if you are using it.

tater_salad
Sep 15, 2007


Gyshall posted:

Yo just a heads up to my homies in the Wordpress thread - the Yoast SEO plugin has a major vulnerability and you should update immediately if you are using it.

Came here to post this. My friendly neighborhood goon host (lithium) already emailed me about it.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

down with slavery posted:

Generally I keep a copy of the database in .sql form in the rep somewhere and update it every time I update the repo

But that seems nuts when the work is split between a whole team. Who has to pore through the db dumps to make sure a merge is correct?

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

Blinkz0rz posted:

But that seems nuts when the work is split between a whole team. Who has to pore through the db dumps to make sure a merge is correct?

Well yeah, if you have a bunch of dev instances you're going to be in for a rough time. Most of the WP sites we work on have a single developer.

snagger
Aug 14, 2004

Blinkz0rz posted:

If they're building a site for a client with multiple developers how do they keep everything in version control given WordPress's predilection for storing lots of stuff in the database?

The shop I work for also puts .sql files in the repo, but in a separate folder from WP, and only updates the file occasionally. I'd like to see us using WP Migrate DB Pro, but so far it just seems like we have peons make content changes on dev and live manually.

snagger
Aug 14, 2004

Gyshall posted:

Yo just a heads up to my homies in the Wordpress thread - the Yoast SEO plugin has a major vulnerability and you should update immediately if you are using it.

I logged in to my Plugins page to find the secure version (1.7.4) already in place. Thanks, Flywheel!

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

Is there an established, obvious solution for testing a local dev WP site on different devices across a local network? I run multiple sites so I've set up virtualhosts in Apache for each one. I've found xip.io, which aims to solve my exact problem. It's a way to point to a site alias from any computer on your network and be able to access the correct site. The URL you use looks like this: http://dev-site-alias.xxx.xxx.x.xxx.xip.io where the xs are my local IP.

It works as advertised, but Wordpress creates a setback; Since Wordpress loves its absolute URLs, all of the resources on the page ignore the xip.io URL and don't load. I've worked around this by setting the "Wordpress Address URL" and "Site Address URL" to the full xip.io URL. Voila, it works.

But I don't like this solution. It relies on a dynamically changing IP address, and it just feels messy and verbose. Are there any simpler methods for this, or have I solved it as well as possible?

fuf
Sep 12, 2004

haha

caiman posted:

Is there an established, obvious solution for testing a local dev WP site on different devices across a local network? I run multiple sites so I've set up virtualhosts in Apache for each one. I've found xip.io, which aims to solve my exact problem. It's a way to point to a site alias from any computer on your network and be able to access the correct site. The URL you use looks like this: http://dev-site-alias.xxx.xxx.x.xxx.xip.io where the xs are my local IP.

It works as advertised, but Wordpress creates a setback; Since Wordpress loves its absolute URLs, all of the resources on the page ignore the xip.io URL and don't load. I've worked around this by setting the "Wordpress Address URL" and "Site Address URL" to the full xip.io URL. Voila, it works.

But I don't like this solution. It relies on a dynamically changing IP address, and it just feels messy and verbose. Are there any simpler methods for this, or have I solved it as well as possible?

Depending on how DNS works on your local network could you just set up certain domains to resolve to your local IP?

I do this with the hosts file on my local machine to avoid having to the change the absolute URLs in the WP db. If the site is ultimately going to be hosted at foobar.com then you can add a line like:
code:
127.0.0.1 foobar.com
And add a virtual host to apache or nginx for foobar.com pointing to wherever the dev files are. Then you can go to foobar.com in your browser and it will load your local dev version instead of whatever is actually at foobar.com.

Just don't forget to remove the line when you're done otherwise you'll think you're checking the live site and actually load the dev version instead.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

If I'm understanding correctly, wouldn't that require the hosts file to be configured on each individual computer/device from which I want to test? That's something I'd like to avoid (do mobile devices even have hosts files?)

fuf
Sep 12, 2004

haha
Yeah it would, unless you can do it centrally from your router or something.

Spatulater bro!
Aug 19, 2003

Punch! Punch! Punch!

Ah. Resolving a URL to my local IP is actually exactly what xip.io is for. It points to an external custom DNS thus eliminating the need to edit local hosts files. But it doesn't eliminate WP's absolute URL problem.

Asshole Masonanie
Oct 27, 2009

by vyelkin
Is anyone familiar with whether or not it's possible to assign a Wordpress virtual subfolder URL as an Apache subdomain?

Ex: making blog.website.com point to website.com/blog

fuf
Sep 12, 2004

haha
Not totally sure what you mean but can't you just set the DocumentRoot for the subdomain to the location of the site files?

e.g, in your apache virtual host:
code:
ServerName blog.website.com
DocumentRoot /var/www/public_html/blog (or wherever your site files are)
Don't forget to change your site address in WordPress.

Alfalfa
Apr 24, 2003

Superman Don't Need No Seat Belt
I'm in the process of tweaking/over hauling my gym's website - http://www.genesisstrength.com/

It currently uses the Avada theme and everything works well.

The only thing I can't figure out how to change/where to change is the responsive menu when loaded on cell phone.

It just has some random options in there and I have no clue where they were populated from or where I need to go to change it.

Any suggestions?

Adbot
ADBOT LOVES YOU

snagger
Aug 14, 2004

Alfalfa posted:

I'm in the process of tweaking/over hauling my gym's website - http://www.genesisstrength.com/

It currently uses the Avada theme and everything works well.

The only thing I can't figure out how to change/where to change is the responsive menu when loaded on cell phone.

It just has some random options in there and I have no clue where they were populated from or where I need to go to change it.

Any suggestions?

Avada appears to have a MegaMenu builder in it that isn't part of the normal WP menu stuff, perhaps the mystery menu was built using that?

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