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
spiritual bypass
Feb 19, 2008

Grimey Drawer

Flaggy posted:

Does anyone have any experience with the W3 Total Cache plugin?

Yeah, it's a beast. What's up?

Adbot
ADBOT LOVES YOU

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

rt4 posted:

Can you make a diagnostic section on a template and check the output of get_settings('home')?
Is there any cache that ought to be cleared in your browser or the server?

Hmm, I think it was wp-super cache. I did a
code:
<!-- <?php echo get_settings('home'); ?> -->
In the _brand.php and no matter what it was not showing up on my local. However I went from my US proxy and it does show up, and the links I removed the "/" work fine now. The weird thing is I checked in WP super cache and it says there 0 files cached or expired. But, it works now. In case anyone else comes across this bizarre problem these are the files I had to change to get all the references:
- _brand.php
- Footer.php
- _footer_nav.php

Thanks for your help; I haven't done anything major in WordPress for like 6 months so I'm sure I'll run into more problems.

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer

rt4 posted:

Yeah, it's a beast. What's up?

Trying to speed up my wordpress site as it has poor loading times. Seems like when I would enable some of the options it would break the site while others seemed to have little effect on it at all. Didn't know if there was a good tutorial out there or if someone here had alot of experience with it.

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
Are you on shared hosting? A bunch of the W3 Total Cache options can be less than noticeable if you can't take advantage of certain PHP/nginx/Apache modules on the server (sometimes they need to be installed.)

Flaggy
Jul 6, 2007

Grandpa Cthulu needs his napping chair



Grimey Drawer

Gyshall posted:

Are you on shared hosting? A bunch of the W3 Total Cache options can be less than noticeable if you can't take advantage of certain PHP/nginx/Apache modules on the server (sometimes they need to be installed.)

Yeah I am on shared hosting. Would it work better on dedicated? I know being on a dedicated will speed it up some as well, would I even need the plugin at that point?

fuf
Sep 12, 2004

haha
If your shared hosting is not that good then the slow loading times might not be anything to do with wordpress at all.

Switching to dedicated would almost certainly speed things up but maybe it's not necessary.

I just switched from Dreamhost to Lithium hosting (goon run and good goon discounts) and even though it's still shared hosting (and actually cheaper) the difference in speed is staggering. I always thought WP was just kinda slow, but now I realise a lot of it was because of bad hosting.

fuf fucked around with this message at 16:03 on Sep 10, 2013

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
Dedicated hosting will almost always be faster. If you're on Dreamhost, try enabling PageSpeed on that domain. Also other tricks - have W3 Total Cache serve up static pages when possible, use Google's javascript libraries, etc.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Hey guys.

I've got my site setup to list 4 posts on the home page. These are the only posts on the site. I have removed their <h1> links so basically you scroll from post to post and it looks like continuous content.

In my header, I'm using wp_get_recent_posts to show the posts in an inline <ul>. However, now I'm trying to figure out how I can link to them on the index page, as opposed to their actual permalink.

Ideally i could do something with anchor IDs, but I've been poking at this for hours and now my brain hurts. Ideas?

Here's what I'm using in the nav:
code:
<ul class="ulnav">
<?php
	$args = array( 'numberposts' => '4' );
	$recent_posts = wp_get_recent_posts( $args );
	foreach( $recent_posts as $recent ){
		echo '<li><a href="' . get_permalink($recent["ID"]) . '" 
		title="'.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
	}
?>
</ul>

fuf
Sep 12, 2004

haha
In the loop where the posts are displayed, give the div for each post a unique id based on their post id:

code:
id="<?php the_ID(); ?>"
Probably here:

code:
<article <?php post_class(); ?> id="<?php the_ID(); ?>">
Then change this line of your nav:

code:
echo '<li><a href="' . get_permalink($recent["ID"]) . '" 
to:

code:
    echo '<li><a href="#' . $recent["ID"] . '" 

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
You hit that out of the park, my friend. Works perfectly, thanks so much! I'll have the site wrapped up today and will post for feedback. Thanks!


PS: Anyone using DreamObjects? .04 per gb, for life. Seems like a decent deal…

pipebomb fucked around with this message at 20:33 on Sep 14, 2013

party hat
Apr 22, 2010
Hello goons. I've run into a problem I can't seem to solve on a custom WP theme I'm working on.

Short version: I need to be able to automatically add an anchor tag to the end of a navigation item where the page is a child of a specific page.

So I've got a navigation item that goes to the Products page--I need it's sub-page menu items to also direct to the products page, but to a certain anchor on that page. So I guess what actually needs to happen is for it to take ../products/drill_bits and change it to .../products#drill_bits without the client having to go alter the menu and manually make the change.

Most of it I can work out fine, I just need to figure out how to change the nav's URL. Any help would be awesome. Thanks!

spiritual bypass
Feb 19, 2008

Grimey Drawer
You'll either need to use mod_rewrite to accommodate the URL or write a custom walker function for your menu template.

party hat
Apr 22, 2010
Ah you're awesome, thanks. I haven't had to alter the navigation menu like that before.

cheese eats mouse
Jul 6, 2007

A real Portlander now
What's a good theme tester for live sites? I'm looking for one that will play nice with Woocommerce.

enthe0s
Oct 24, 2010

In another few hours, the sun will rise!
How does Wordpress minify its CSS? Is it an automatic thing or do you have to do it yourself?

fuf
Sep 12, 2004

haha

enthe0s posted:

How does Wordpress minify its CSS? Is it an automatic thing or do you have to do it yourself?

All the css is in your theme folder, and you have to minify it yourself.

(I might be wrong about this but it's what I've always assumed)

enthe0s
Oct 24, 2010

In another few hours, the sun will rise!

fuf posted:

All the css is in your theme folder, and you have to minify it yourself.

(I might be wrong about this but it's what I've always assumed)

I was hoping that was not the case, since Google mostly came up with plugins to minify it as well. Oh well, thanks!

fuf
Sep 12, 2004

haha

enthe0s posted:

I was hoping that was not the case, since Google mostly came up with plugins to minify it as well. Oh well, thanks!

It's not too hard to minify everything locally before you upload though? I'm not sure why you would want wordpress to do it.

enthe0s
Oct 24, 2010

In another few hours, the sun will rise!

fuf posted:

It's not too hard to minify everything locally before you upload though? I'm not sure why you would want wordpress to do it.

Well, it was using minified CSS, so I figured that if it's going to bother using it, it would also generate it as well. It's not a big deal to minify, it just doesn't make sense to me why they would do it this way.

fuf
Sep 12, 2004

haha
Can we discuss "useful plugins that should go on every WP install"?

I like Limit login attempts and BackupWordPress

Do people use Akismet? It looks like you have to pay now?

fuf
Sep 12, 2004

haha
What happened wordpress thread I thought you were cool :(

Nimrod
Sep 20, 2003

fuf posted:

Do people use Akismet? It looks like you have to pay now?

I'm not sure exactly how useful it is really, but I just signed up for a new key like 2 or 3 days ago. I think you have to register a wordpress.com account?

fuf
Sep 12, 2004

haha
Yeah you need a wordpress.com account, and turns out you can choose a personal plan for free. :)

Vintersorg
Mar 3, 2004

President of
the Brendan Fraser
Fan Club



Am I overreaching here? I have a custom post type with custom taxonomy and I am trying to make a list of all the items there. I want to separate each listing tho by their taxonomy. I am getting zero output with the following code.

PHP code:

// create shortcode to list partnerships
add_shortcode( 'partner_list', 'partner_list_function' );

function partner_list_function(){
    
    $categories = get_terms( 'partners_category', 'orderby=count&hide_empty=0' );
    $count = count($categories);

if ( $count > 0 ){

     foreach ( $categories as $term ) {
        ob_start();
      $query = new WP_Query( array(
        'post_type' => 'partners',
        'tax_query' => array(
            array(
                'taxonomy' => 'partners_category',
                'field' => 'slug',
                'terms' => $term->slug
            )),
        'posts_per_page' => -1,
        'order' => 'DESC',
        'orderby' => 'date',
        ));
        // The Loop
       echo '<h1>' . $term->name . '</h1>';
        if ( $query->have_posts() ) {
            while ( $query->have_posts() ) {
                $query->the_post();
                echo '<li>' . get_the_title() . '</li>';
            }
            wp_reset_postdata();
            $myvariable .= ob_get_clean();
        } //end $query if
     } //end $category foreach
 } //end $count if
  return $myvariable;
}
The above spits out nothing right now.

I haven't formatted the text yet as I cannot get a listing but I want something like TAXONOMY TITLE - post title.


Okay, I can get the title to come out now after modifying the loop. But it's only spitting out the last item. I wonder if my reset is loving it up and erasing the previous output.

Figured it out! Like a loving idiot I was overwriting the drat $myvariable each time. I took it out of the entire thing and just used .= to keep adding to it. Also added ob_start inside the first for loop. I get the exact output I need. Now just to organize this crap (this client has 125 partners and they want them all listed on the page.....).

Vintersorg fucked around with this message at 22:48 on Sep 23, 2013

wwb
Aug 17, 2004

Is there any way to setup wordpress so that you can have the public-facing site at http://example.com and then the admin tools only listening to something like https://s.example.com/wp-admins/sitename ? I have seen examples to rewrite urls over to a similar folder structure but I'm trying to get everything under one SSL-enabled site with sub uris and such.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Hey wordpress gurus -

I've had a friend approach me for his little brochure ware site that has been exploited to show a div full of viagra spam to IE8 users (sorry web sense users this page will probably get blocked now):
code:
<!--[if IE 8]> <div id='HiddenDiv'> Cam includes ejaculatory disorders such as Buy Cialis <a href="hxxp://el-au.org/" title="Buy Cialis">Buy Cialis</a>
previously discussed in march. Secondary sexual dysfunction to give them Cialis <a href="hxxp://www.arrowheadtravelplaza.com/" title="Cialis">Cialis</a>
relief from this condition. Much like or sexual activity and overactive Tele Track Pay Day Loans 
<a href="hxxp://asaferide.org/" title="Tele Track Pay Day Loans">Tele Track Pay Day Loans</a><!--[EndIf]-->
I'm not a wordpress expert, but I've found the inserted code in header.php. His version is 3.51 so obviously upgrading is a concern, but I'm wondering about future tasks. Was 3.51 that exploitable compared to 3.61? E.g. upgrading will plug the hole?

EDIT-Arggh broke tables

Double arggh upgrading to 3.61 broke all his menus and images

Scaramouche fucked around with this message at 21:12 on Sep 27, 2013

Love Stole the Day
Nov 4, 2012
Please give me free quality professional advice so I can be a baby about it and insult you
edit- i am dumb and bad....

Love Stole the Day fucked around with this message at 03:55 on Oct 31, 2017

Robot Arms
Sep 19, 2008

R!
I originally asked this in the PHP thread, but they sent me here. I need some help getting started.

I'm using WordPress for lawyerist.com. It's my own, custom theme. Here's what I'm trying to do:

Loop 1:
* If the post was published on or after Monday, publish it in Loop 1.
* If the post is the most-recent post *and* it was published today, tag it with class="current".

Loop 2:
* If the post was published before Monday, publish it in Loop 2.

Thanks in advance for any help you can give me. I'm cool with doing multiple loops. Mostly, I'm trying to figure out how to say "if the post was published on or after Monday" and "if the post was published before Monday" in PHP.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Comparing date('N') to see if it's >=6 (Saturday) ought to get what you need

http://www.php.net/manual/en/function.date.php

a lovely poster
Aug 5, 2011

by Pipski

samglover posted:

I originally asked this in the PHP thread, but they sent me here. I need some help getting started.

I'm using WordPress for lawyerist.com. It's my own, custom theme. Here's what I'm trying to do:

Loop 1:
* If the post was published on or after Monday, publish it in Loop 1.
* If the post is the most-recent post *and* it was published today, tag it with class="current".

Loop 2:
* If the post was published before Monday, publish it in Loop 2.

Thanks in advance for any help you can give me. I'm cool with doing multiple loops. Mostly, I'm trying to figure out how to say "if the post was published on or after Monday" and "if the post was published before Monday" in PHP.

What have you tried/done so far?

Wordpress' codex has some quality documentation, and it's very easy to filter posts by date published.

http://codex.wordpress.org/The_Loop
http://codex.wordpress.org/Function_Reference/get_posts

More or less, get_posts will return an array where you can use the built-in PHP functions to filter by date.

If you want to get really smart about it, you can modify the actual query so you only return the required data

http://codex.wordpress.org/Class_Reference/WP_Query
http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters

Robot Arms
Sep 19, 2008

R!

rt4 posted:

Comparing date('N') to see if it's >=6 (Saturday) ought to get what you need

http://www.php.net/manual/en/function.date.php

Thanks! I think that's enough to get me started.


This, too.

Robot Arms fucked around with this message at 03:51 on Oct 2, 2013

nonathlon
Jul 9, 2004
And yet, somehow, now it's my fault ...
Is there any add-on that would be good for software packages?

I've got about a dozen software projects with their home pages on my (old) website and I can't figure the right way to make them a new home on my new WP site. Having had to search other WP sites for software, I wonder if there is one. I'd like the page to display "about" text, pointers to publications, pointers to the dev repo and bug tracker and a list of releases or versions. Any ideas?

spiritual bypass
Feb 19, 2008

Grimey Drawer
It's not hard, but you'll need to do a little development in your theme to make it happen.

Make a custom post type for your software project and add new fields (about, publications, repo, bug tracker) with the Advanced Custom Fields plugin. Then, create archive and single templates for your custom post type with your new fields on it.

spiritual bypass
Feb 19, 2008

Grimey Drawer
edit: nevermind, I'm totally wrong about all of what I just asked

spiritual bypass fucked around with this message at 21:36 on Oct 9, 2013

chami
Mar 28, 2011

Keep it classy, boys~
Fun Shoe
This seems like a basic question, but I was wondering if there was a way to assign classes to custom post content short of typing it out inside the post content editor. For example, if I were using Twitter Bootstrap, assigning .col-3-md to images and then .col-9-md to the following text. I guess I could put the loop in a div and then style those via nth-child, but is there a less roundabout way of doing this?

spiritual bypass
Feb 19, 2008

Grimey Drawer
You could fetch the attached images in your template (or use Advanced Custom Fields) instead of inserting the images into the post body.

http://codex.wordpress.org/Function_Reference/get_children
http://www.advancedcustomfields.com/resources/field-types/image/

Jimlit
Jun 30, 2005



Scaramouche posted:

Hey wordpress gurus -

I've had a friend approach me for his little brochure ware site that has been exploited to show a div full of viagra spam to IE8 users (sorry web sense users this page will probably get blocked now):
code:
<!--[if IE 8]> <div id='HiddenDiv'> Cam includes ejaculatory disorders such as Buy Cialis <a href="hxxp://el-au.org/" title="Buy Cialis">Buy Cialis</a>
previously discussed in march. Secondary sexual dysfunction to give them Cialis <a href="hxxp://www.arrowheadtravelplaza.com/" title="Cialis">Cialis</a>
relief from this condition. Much like or sexual activity and overactive Tele Track Pay Day Loans 
<a href="hxxp://asaferide.org/" title="Tele Track Pay Day Loans">Tele Track Pay Day Loans</a><!--[EndIf]-->
I'm not a wordpress expert, but I've found the inserted code in header.php. His version is 3.51 so obviously upgrading is a concern, but I'm wondering about future tasks. Was 3.51 that exploitable compared to 3.61? E.g. upgrading will plug the hole?

EDIT-Arggh broke tables

Double arggh upgrading to 3.61 broke all his menus and images

The security issues are most likely plugin related. A lot of wordpress security concerns can come from holes generated by installed plugins. The first step I would take is to look into the plugins you have installed and see if there are any know security issues. Secondly I would recommend looking at solutions on https://www.projecthoneypot.org/. There are a couple of black list plugins there than can track what known malicious ip's are coming to your site. You might be shocked to see how many times a day you get hit.

I have seen these attacks on sites sky rocket in the last few months for my clients. The only thing I can figure is recent updates to google search algorithms has made link spammers desperate.

As for the tables and images breaking, it sounds like your theme is updating and over writing your content due to no child theme being set up.

Antifreeze Head
Jun 6, 2005

It begins
Pillbug
I'm hoping this is the correct spot for a small question (perhaps just a confirmation) about WordPress.

Am I correct in my thinking that there is no way to create a new template page for a theme without access to the directories to place the new .php file, or is there some way that someone with administrator rights can create one from the WordPress dashboard?

As a follow up, if there is a way to do it without dropping in that .php file, what is it? I sure as hell can't find it if it exists.

slartibartfast
Nov 13, 2002
:toot:
This is a little stupid, but off the top of my head, the only way I can think to do it would be to create a plugin, then upload it to the dashboard to install it. If that's possible, then maybe you can have the plugin detect the current theme and create the .php file inside the theme directory.

Adbot
ADBOT LOVES YOU

kedo
Nov 27, 2007

e: This post was a lie because I misread a button. :doh:

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