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
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.

Adbot
ADBOT LOVES YOU

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

Robot Arms
Sep 19, 2008

R!

lol internet. posted:

I was wondering if it's possible to make a wordpress "page" a "contact form" which has a couple fill-in boxes, one being email and content with the ability to hit "send"

Contact Form 7


Gravity Forms is pretty powerful, and I'd be surprised to find out that it doesn't do what you want. The same goes for Wufoo. Neither is free, but Gravity Forms is a great deal at $39 for a personal license. Wufoo charges monthly, which probably isn't ideal for you, but I prefer Gravity Forms, anyway.

Robot Arms
Sep 19, 2008

R!
I'm trying to build a front page that has only posts from this week. This part, I can do.

Then, I want to show all previous posts, starting on page 2. This is the part I'm having trouble with. What it does right now is show this week's posts on page 1, and starts page 2 right where it otherwise would given my settings, with the 11th post. Here's what I've got so far:

code:
	<?php 

	/* LOOPS */

		$week = date('W');
		$year = date('Y');
		$my_query = new WP_Query( 'year=' . $year . '&w=' . $week );
		
		/* FRONT PAGE LOOP */

		if ( !is_paged() ) {

			$post_num = 1;
			
			while ( $my_query->have_posts() ) : $my_query->the_post();
			
				$num_comments = get_comments_number(); ?>

				<a class="index_post post" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>, posted on <?php the_time('F jS, Y'); ?>">

					<?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); } ?>
			
					<div class="headline_excerpt">
						<h2 class="headline remove_bottom" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
						<div class="postmeta">
							<?php if ( $num_comments > 0 ) { ?>
								<div class="comment_link th_comment_link"><div class="comment_bubble"></div> <?php comments_number('leave a comment','1 comment','% comments'); ?></div>
							<?php } ?>
							<div class="author_link">by <?php the_author(); ?></div>
							<p class="excerpt remove_bottom<?php if ( has_post_thumbnail() ) { echo ' excerpt_with_thumb'; } ?>"><?php echo get_the_excerpt(); ?></p>
						</div>
					</div>

					<div class="clear"></div>

				</a>

				<?php $post_num++;
				
			endwhile;

		}

		/* PAGED LOOP */
		
		else {
		
			if ( have_posts() ) : while ( have_posts() ) : the_post();

				$num_comments = get_comments_number(); ?>
		
				<a class="index_post post" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>, posted on <?php the_time('F jS, Y'); ?>">

					<?php if ( has_post_thumbnail() ) { the_post_thumbnail('thumbnail'); } ?>
			
					<div class="headline_excerpt">
						<h2 class="headline remove_bottom" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
						<div class="postmeta">
							<?php if ( $num_comments > 0 ) { ?>
								<div class="comment_link th_comment_link"><div class="comment_bubble"></div> <?php comments_number('leave a comment','1 comment','% comments'); ?></div>
							<?php } ?>
							<div class="author_link">by <?php the_author(); ?></div>
							<p class="excerpt remove_bottom<?php if ( has_post_thumbnail() ) { echo ' excerpt_with_thumb'; } ?>"><?php echo get_the_excerpt(); ?></p>
						</div>
					</div>

					<div class="clear"></div>

				</a>
				
			<?php endwhile; endif;
		
		}
		
	/* END LOOPS */ ?>
How would I get page 2 to pick up where page 1 left off?

Edit: I should just be using a static front page with its own template, shouldn't I?

Robot Arms fucked around with this message at 03:54 on Oct 20, 2013

Robot Arms
Sep 19, 2008

R!
I'm getting some weird more tag behavior on my blog, with a custom theme.

This post, for example, looks find if you go to the regular URL: http://caveatemptorblog.com/mcdonalds-publishes-guide-tipping-help-minimum-wage-employees/

But if you click on the Keep reading --> link, you cannot scroll up past the break: http://caveatemptorblog.com/mcdonalds-publishes-guide-tipping-help-minimum-wage-employees/#more-11741

Edit: In fact, it works for any anchor: http://caveatemptorblog.com/heres-income-inequality-us-looks-like-one-image/#disqus_thread

Any idea what could be causing this? I'm stumped.

Robot Arms fucked around with this message at 07:47 on Dec 10, 2013

Robot Arms
Sep 19, 2008

R!

RobertKerans posted:

overflow:hidden on the #page_container is causing it. There's a scroll happening, it's just hidden. You'll need to check it doesn't break anything else, but that should fix the primary problem, it works fine if I delete the rule in devtools.

Thank you!

Robot Arms
Sep 19, 2008

R!
I'm trying to get my theme to automatically add a "from the archives" tag to posts that are older than one month/30 days. So something like this:

code:
<?php if ( post is more than 30 days old ) { ?>
   <div class="archive_tag">From the Archives</div>
<?php } ?>
I'm just not sure how to say "post is more than 30 days old" in WordPress/PHP-ese. It will be within the Loop, if that matters.

Little help/push in the right direction?

Robot Arms
Sep 19, 2008

R!

Worked like a charm. You rock!

Robot Arms
Sep 19, 2008

R!

Weird Uncle Dave posted:

What's the current state-of-the-art for managing lots of WordPress sites?

I don't know if it's state of the art, but we just went with a multisite install for our sites. It's 37 sites now, and multisite is working well so far.

Robot Arms
Sep 19, 2008

R!
I'm building this for fun, and maybe for my personal blog: http://samglover.net/terminal/

I didn't see anything similar in the official WordPress themes directory. This was the closest I found. I'm also trying to do it all with just index.php and comments.php (I particularly like the commenting form), instead of the usual collection of theme files.

It's definitely a work in progress, but you can get the general idea.

Robot Arms fucked around with this message at 16:30 on Apr 25, 2014

Robot Arms
Sep 19, 2008

R!
I want to be able to style Markdown-formatted text within the editor. In other words, I want to be able to make a heading bold, and make italicised text show up italicized. If you've used a text editor like Byword, you know what I mean.

So if I enter this:

pre:
### Heading 3
It will show up in the editor like this:

pre:
### Heading 3
Obviously, this only works if it can happen as I type.

Is this possible, or am I dreaming?

Robot Arms
Sep 19, 2008

R!
I don't think there's a plugin, either. I was planning to do it myself. I've already styled the editors a bit. I've always felt like the font for the text editor sucked, and it was too small with not enough line height. So I use 16px Source Code Pro, instead (and 18px Source Sans Pro in the visual editor). But I was hoping I could style it even further as I type. I'm just not sure where to start.

Robot Arms
Sep 19, 2008

R!
Bro, that doesn't do highlighting in the editor.

Lots of plugins (including Jetpack) support Markdown. None that I can find support syntax highlighting in the editor. Although I wonder if I could use Prettify to do that. That's what WP-Markdown uses for previewing Markdown in comments.

Robot Arms
Sep 19, 2008

R!
Just published my first plugin: https://wordpress.org/plugins/wp-editor-tweaks/

It's not much, but it makes it much more pleasant to write in WordPress if you use the Text editor. (It's only a small improvement if you use the Visual editor.)

Robot Arms
Sep 19, 2008

R!

wordsauce posted:

Include screenshots.

Thanks for the tip. Will do.

Edit: Done. Now I just have to remember to keep them up to date.

Robot Arms fucked around with this message at 17:28 on Jun 30, 2014

Robot Arms
Sep 19, 2008

R!
That's Tim Ferriss's, right? IIRC, it's custom-built with DOMTab and the WordPress Popular Posts plugin. I based the popular posts sidebar widget on lawyerist.com off of Tim Ferriss's widget, but I found idTabs easier to use.

To get the plugin working, you have to drop the jquery.idTabs.min.js file into your theme's directory and load it in the footer with this line of code:

code:
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/jquery.idTabs.min.js"></script>
Then you need to add something like this to your sidebar:

code:
<li id="popular_posts_tabbed">
		<h3>Popular Posts</h3>
		<ul class="idTabs">
				<li><a href="#current">This Week</a></li>
				<li><a href="#all-time">All-Time</a></li>
				<li><a href="#our-picks">Our Picks</a></li>
		</ul>

		<div id="current" class="tabs_sublist">
				<?php wpp_get_mostpopular("post_type='post'&range=weekly&limit=5&stats_comments=0&thumbnail_height=75&thumbnail_width=75&post_html='<li>{thumb}<a class=\"wpp_headline\" href=\"{url}\">{text_title}</a></li>'"); ?>
		</div>

		<div id="all-time" class="tabs_sublist">
				<?php wpp_get_mostpopular("post_type='post'&range=all&limit=5&stats_comments=0&thumbnail_height=75&thumbnail_width=75&post_html='<li>{thumb}<a class=\"wpp_headline\" href=\"{url}\">{text_title}</a></li>'"); ?>
		</div>

		<div id="our-picks" class="tabs_sublist">
				<?php wpp_get_mostpopular("post_type='post'&cat='my-picks'&range=all&limit=5&stats_comments=0&thumbnail_height=75&thumbnail_width=75&post_html='<li>{thumb}<a class=\"wpp_headline\" href=\"{url}\">{text_title}</a></li>'"); ?>
		</div>
</li>
To do this, you should probably just use functions, but you can probably find plugins that allows you to add scripts and use php in sidebar widgets.

Then you can fiddle with the CSS until you get the look you want.

Robot Arms fucked around with this message at 22:49 on Jul 14, 2014

Robot Arms
Sep 19, 2008

R!

Omits-Bagels posted:

would you be willing to do the same for my site?

Sure thing. I'll shoot you an email.

Robot Arms
Sep 19, 2008

R!

Disharmony posted:

Probably a question that's been answered already but how do I hide categories from showing up in the front page but not anywhere else?

code:
if ( !is_front_page() ) {
    SHOW CATEGORIES
}

Robot Arms
Sep 19, 2008

R!
You want to hide posts from a category or the category in the post meta/byline?

Robot Arms
Sep 19, 2008

R!
You need to use separate templates for the front page and for archive pages.

Just copy your index.php to archives.php, and remove the category targeting from your query_posts function in archive.php.

Robot Arms fucked around with this message at 03:02 on Aug 8, 2014

Robot Arms
Sep 19, 2008

R!
Our WordPress install for Lawyerist.com is over 7 years old, now. We've installed and removed probably hundreds of plugins during that time, and our database is full of cruft. I use WP Optimize to keep the database healthy, but that doesn't clean out the stuff that is no longer attached to any plugin.

I've manually removed some of the tables left by plugins we no longer use, but there are dozens or hundreds of junk rows in wp_options, wp_postmeta, etc. I'm kind of a neat freak and this drives me crazy. Is there a recommended plugin or procedure to clean out the cruft from our database? Does it even matter?

Robot Arms
Sep 19, 2008

R!
The easiest way to do it is probably with IFTTT + Gmail + Buffer. It sounds complicated, but it's not. I just have IFTTT monitor our RSS feed for new posts. When it sees one, it sends an email with a link and a "post now" signal to Buffer, and Buffer uses that to update our Twitter account, Facebook page, LinkedIn company page, and Google+ page.

Robot Arms
Sep 19, 2008

R!
You're right. I totally forgot about that. We just use the Gmail hack to make it work with all our social media accounts at once.

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.

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?

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

Robot Arms
Sep 19, 2008

R!
For sliders, I really like Theia Post Slider. You can see it in action here and here. You just use the regular <!--nextpage--> tag in the editor to switch between slides, and you can set different header and footer content. It's also quite smooth, as you can see.

Edit: Oh, it doesn't do an index, though. That would be pretty cool.

Robot Arms
Sep 19, 2008

R!
We use VaultPress for realtime backups. It's great if your WordPress install is still functioning. But since your WordPress install has to be functioning, it's limited if you have broken it.

Our server does daily backups, which we can access in case of disaster. I download a full backup once a month, as well. I could probably automate that, but it's not much bother.

Edit: After writing this, I logged into my VaultPress account. It looks like you can restore a broken install. Sweet.

Robot Arms fucked around with this message at 03:53 on Oct 29, 2014

Robot Arms
Sep 19, 2008

R!
What's the best way to get share counts for a post? I want to be able to display share counts on the front page a la Mashable or something. I know Jetpack (which we use) tracks share counts for each network you show. Can I hook into the API and add those up, or something? Or is there an easier way to do it (I'm not afraid of functions.php or just building my own plugin)?

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.

Robot Arms
Sep 19, 2008

R!
If you want a little chat pop-up for sales or support, then I dunno.

But if you want an embeddable chatroom, tlk.io is pretty simple and great.

Robot Arms
Sep 19, 2008

R!
I'd like to have a "safety" for the Schedule/Publish button. Even just an "Are you sure you want to do that?" pop-up would help keep me from publishing posts when I just mean to change their status. Has anyone encountered a plugin like this? If not, how would I do this myself?

Robot Arms
Sep 19, 2008

R!
That's perfect. Thanks!

Robot Arms
Sep 19, 2008

R!

well why not posted:

The 'export' function in WP's admin will let you export all content.

No, this just gets you an XML file. It has all the information about the posts and pages on your site, but none of the content itself. It's really only for transferring your content from one WordPress site to another, but both sites have to be online for it to work, because the file just tells the new site where to go to suck all the information out of the old site.

If you want to back up your site, you need to back up your WordPress directory and the database. There are lots of plugins that will handle this for you, or you can do it manually from your server's control panel.

Adbot
ADBOT LOVES YOU

Robot Arms
Sep 19, 2008

R!
We use TablePress and it's fine. You can sort columns, search, import spreadsheets, etc.

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