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
huhu
Feb 24, 2006
Awesome thanks for the replies.

Another question, what is a good article to read about the best plugins/tools/etc to get going to secure your WordPress? I don't want to grab the first result off Google and I've looked around the Codex but it's a big more exhaustive than I'd like.

Adbot
ADBOT LOVES YOU

fuf
Sep 12, 2004

haha
WordFence has been good for me for security so far.

http://tidyrepo.com/ has a collection of good plugins.

huhu
Feb 24, 2006
Thanks again.

New question, I've created a template for how I'd like my posts to appear in HTML. There are several different fields in the template including "date", "source", "highlights", "description". I'd like to be able to, when I create a new post see a form where I can input each of these items and have them show up correctly in the HTML template. Is this possible with WordPress? Just a point in the right direction would be great.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.

huhu posted:

Another question, what is a good article to read about the best plugins/tools/etc to get going to secure your WordPress? I don't want to grab the first result off Google and I've looked around the Codex but it's a big more exhaustive than I'd like.

Here's a giant article which covers just about everything you can do: Wordpress Security: The Ultimate Guide
You probably want to start with:
  • Limit login attempts
  • Strengthen htaccess rules
  • Disable error reporting
  • Hide the wordpress version
  • Hide the login (move admin to a new location)
Then tackle whatever.


huhu posted:

Thanks again.
There are several different fields in the template including "date", "source", "highlights", "description". I'd like to be able to, when I create a new post see a form where I can input each of these items and have them show up correctly in the HTML template.
Pretty sure you can do this with the free edition of Advanced Custom Fields. Install it, go to the field management bit, and set up some fields that you attach to the Post type.
Then you can display the data using the get_field() function as outlines on their homepage.

huhu
Feb 24, 2006

v1nce posted:

Here's a giant article which covers just about everything you can do: Wordpress Security: The Ultimate Guide
You probably want to start with:
  • Limit login attempts
  • Strengthen htaccess rules
  • Disable error reporting
  • Hide the wordpress version
  • Hide the login (move admin to a new location)
Then tackle whatever.

Pretty sure you can do this with the free edition of Advanced Custom Fields. Install it, go to the field management bit, and set up some fields that you attach to the Post type.
Then you can display the data using the get_field() function as outlines on their homepage.
Got some follow up questions about the forms/post templates.

This is the template I'd like to make: http://www.travisbumgarner.com.php54-4.ord1-1.websitetestlink.com/93/
This is the progress so far: http://www.travisbumgarner.com.php54-4.ord1-1.websitetestlink.com/programming/

Issue with that is I'd like the content before the horizontal line break just under "May 24, 2015 Coding Blog, Website updates". Also, the CSS isn't loading correctly (can be seen in the first example loading correctly.

Also, I've also used a custom page template and this is what it looks like (still have to clean up the CSS off of this post):
code:
<?php
/*
Single Post Template: Code Examples
Description: This page provides a template for coding examples.
*/
?>


<?php
/**
 * The template for displaying all single posts
 *
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0
 */

get_header();?>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<style>

</style>
	<div id="primary" class="content-area">
	<div id="content" class="site-content" role="main">
		 <?php get_template_part( 'content', get_post_format() ); ?>
		 <div class="container">
			<div class="row code-post">
			<div class="col-xs-12">
				<h3><span style="color: #bd0000;">Highlights: </span></h3>
				<?php the_field('code_highlights'); ?>
				<h3><span style="color: #bd0000;">Language: </span><?php the_field('code_language'); ?></h3>
				<h3><span style="color: #bd0000;">Source:</span> <?php the_field('code_source'); ?></h3>
				<h3><span style="color: #bd0000;">Problem Statement:</span></h3>
				<?php the_field('code_problem_statement'); ?>
				<h3><span style="color: #bd0000;">Problem Solution:</span></h3>
				<?php the_field('code_solution'); ?>
			</div>
			</div>
		</div>
		<?php /* The loop */ ?>
		<?php while ( have_posts() ) : the_post(); ?>
			<?php twentythirteen_post_nav(); ?>
			<?php comments_template(); ?>

		<?php endwhile; ?>
	</div><!-- #content -->
	</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
Another thing, this is my posts page: http://www.travisbumgarner.com.php54-4.ord1-1.websitetestlink.com/category/coding-blog/
The content isn't getting loaded in.

Apologies, I know nothing of PHP yet and not quite ready to delve into it.

Edit: Was thinking a potential solution, since I'm also having issues with the shortcode for the coding syntax markup, that I could put the code in the default content field and then move that in the php file to where the header "Solution: " is. ...if that makes any sense.

huhu fucked around with this message at 22:05 on May 25, 2015

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Your CSS problem is because you've got a second inclusion of the bootstrap.min.css in your template:
code:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
You already include bootstrap.css in the header, so this second declaration is messing with your styles (loading order!)

At the start of the template file you've got the WP file annotations, but then you close and re-open the PHP tags. Avoid closing tags before you've called get_header(). This is injecting return carriages before the <!DOCTYPE html> tag, which is not great (view source on your page).

You're getting a horizontal bar because <?php get_template_part( 'content', get_post_format() ); ?> is pumping out an <article class="post"> tag, and the CSS for .post is what adds that border. You probably want to fix your CSS so that a border isn't put on every .post element?
Maybe something like:
code:
.post {
    border-bottom: 0px none;
}
.archive-header .post {
    border-bottom: 10px solid #ccc;
}
That way, .post gets the border (separator) on the archive pages, but not on a post viewing page.


For that last bit where you don't want the content to be shown.. well, this is a total guess, but:
Edit your achive template and look for "get_template_part". It's probably grabbing 'content', which points at content.php.
Change this to 'archive_summary' and make a copy of content.php and call it archive_summary.php.
Edit that new file, and take out the bit that dumps the actual body of the post. Or google the function that's doing it, and see what options you can pass it.

I think. I haven't arsed about with wordpress for ages.

my bony fealty
Oct 1, 2008

huhu posted:

Thanks again.

New question, I've created a template for how I'd like my posts to appear in HTML. There are several different fields in the template including "date", "source", "highlights", "description". I'd like to be able to, when I create a new post see a form where I can input each of these items and have them show up correctly in the HTML template. Is this possible with WordPress? Just a point in the right direction would be great.

Wordpress can do this! In fact it's what makes it a powerful CMS, in my experience.

If I understand you correctly, you want to use a Custom Post Type to create a new type of post that has all of those input fields, and then set up a page template to take that information and display it.

This tutorial might point you in the right direction, it covers both a plugin that makes it easy as well as doing it by hand -

http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/

e: this tutorial goes way further in depth about creating meta boxes, which you would use to make those fields -

http://themefoundation.com/wordpress-meta-boxes-guide/

my bony fealty fucked around with this message at 04:23 on May 27, 2015

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
What's the easiest way to use WooCommerce to set up a virtual product (a service, not a physical item or digital download) that's something like "£10 for the first 1000 words, plus another £5 for every additional 1000"? Ideally, it'd be possible to also have the price (initial and 'per 1000 words') change based on three tiers of service.

Would I need to have a 'base' product and a separate '1000 words' product per tier, and bundle them together somehow? How do I protect against weirdness like accidentally ordering one of the 'base' tiers and ordering a bunch of extra words from a different tier entirely?

the heat goes wrong
Dec 31, 2005
I´m watching you...

Surprise T Rex posted:

What's the easiest way to use WooCommerce to set up a virtual product (a service, not a physical item or digital download) that's something like "£10 for the first 1000 words, plus another £5 for every additional 1000"? Ideally, it'd be possible to also have the price (initial and 'per 1000 words') change based on three tiers of service.

Would I need to have a 'base' product and a separate '1000 words' product per tier, and bundle them together somehow? How do I protect against weirdness like accidentally ordering one of the 'base' tiers and ordering a bunch of extra words from a different tier entirely?

Does your order range get really high? Something like 37k words? Or are they nearly always under 10-15k?
Otherwise, the easiest would probably set up few filters (Using a t-shirt store for example: t-shirts are available in red, blue and black. Sizes XXS, XS, S, M, L, XL, XXL etc All colours and sizes have different prices.). In our case, just replace colours with tiers and XXS with £10/1k words, XS with £15/2k words and so on.

fuf
Sep 12, 2004

haha
I'm doing my fist woocommerce store right now and I've made it extra hard for myself by importing all the products from Magento. I don't really have any reference for what a normal woocommerce store looks like so I'm not sure if the import worked properly or not. The products are mirrors with options for dimensions and colour. These are set up as variable products with a different variation for every combination of dimension and colour. Is that normal? Seems weird.

The client has also requested the ability to add logins for traders to get reduced prices on all products, and I have no idea how to set that up.

Anyone want to earn $100 or so and take a look for me and offer some advice?

edit: Oh I have a mutli-language site that I need someone to help me fix too. I should probably post this in the job thread.

fuf fucked around with this message at 12:18 on Jun 3, 2015

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
https://wordpress.org/plugins/wholesale-pricing-for-woocommerce/ will help for the wholesaling

jackpot
Aug 31, 2004

First cousin to the Black Rabbit himself. Such was Woundwort's monument...and perhaps it would not have displeased him.<
How easy would it be for me to install a wordpress theme in a subfolder of my own site, set everything up the way I want it, then move that whole site to another site? Is that basically a matter of creating a backup of the site once I'm done, then importing that backup once I've installed the theme on the other domain? It's been years since I've had to do anything with wordpress.

snagger
Aug 14, 2004

jackpot posted:

How easy would it be for me to install a wordpress theme in a subfolder of my own site, set everything up the way I want it, then move that whole site to another site? Is that basically a matter of creating a backup of the site once I'm done, then importing that backup once I've installed the theme on the other domain? It's been years since I've had to do anything with wordpress.

It can be challenging on the first try, but pro WP developers deal with this on a daily basis (they'll do their development work on their own machine then push everything to the 'production' or live server). You need to worry about 3 separate factors:

-The database contents - databases are stored locally, and everything on a WP site lives in the database (like the contents of your pages/posts and theme configuration). There are plugins to help you quickly move contents from one database to another.
-The database connection - the location, name, and login details for the databases may be different. Most devs run a find/replace on wp-config.php to swap between one server and the other.
-The file content (WP may look in the wrong folders for certain things) - not a frequent issue, but could be a problem on the first go.

Is there a reason you're doing it this way as opposed to just settings things up the first time on the other server?

Weird Uncle Dave
Sep 2, 2003

I could do this all day.

Buglord
The network security folks at work just recently discovered Suhosin, and are asking if I could install it on my LAMP stack. Is WordPress going to suddenly stop working for no reason if I do this?

(I'd start by running Suhosin in "simulation" mode to log errors but not act on them, of course, but I'd like to know what to expect.)

jackpot
Aug 31, 2004

First cousin to the Black Rabbit himself. Such was Woundwort's monument...and perhaps it would not have displeased him.<

snagger posted:

It can be challenging on the first try, but pro WP developers deal with this on a daily basis (they'll do their development work on their own machine then push everything to the 'production' or live server). You need to worry about 3 separate factors:

-The database contents - databases are stored locally, and everything on a WP site lives in the database (like the contents of your pages/posts and theme configuration). There are plugins to help you quickly move contents from one database to another.
-The database connection - the location, name, and login details for the databases may be different. Most devs run a find/replace on wp-config.php to swap between one server and the other.
-The file content (WP may look in the wrong folders for certain things) - not a frequent issue, but could be a problem on the first go.

Is there a reason you're doing it this way as opposed to just settings things up the first time on the other server?
Thanks for all that. The reason - and maybe I'm going about this all wrong - is that the destination site is probably going to be changing hosting sometime soon, after I've started putting the new site together. I figured I'm going to have to build it in one place, back it up, and then restore it on the new host to make this work. Right? Or am I way off?

fuf
Sep 12, 2004

haha
Duplicator plugin does exactly that and might be easier than doing it manually. Check it out.

kedo
Nov 27, 2007

fuf posted:

Duplicator plugin does exactly that and might be easier than doing it manually. Check it out.

Definitely look into this, but there's no reason you can't move a WP site from one server/domain to another manually too. There might be small differences between the different servers that might impact your site, but that rarely happens. (eg. if the different servers have different versions of PHP some of your code in templates might not work).

If you transfer things manually the process generally looks like this:

• Ensure you have an up to date version of all the WP files accessible by FTP (either keep a local copy or just download it from your development server)
• Export your database following WordPress's instructions
• Optionally, if you're changing the domain you can open up the .sql file you just downloaded and do a find/replace for instances of the old domain
• Upload database and files to new site, making adjustments where needed (eg. wp-config)

But look in to Duplicator first. Knowing how to move a site yourself without the use of plugins can be a good learning opportunity, but if there's an easy way to streamline the process you may as well use it.

jackpot
Aug 31, 2004

First cousin to the Black Rabbit himself. Such was Woundwort's monument...and perhaps it would not have displeased him.<
Thanks for Duplicator, that sounds really, really nice. I'll definitely head in that direction.

fuf
Sep 12, 2004

haha
Any tips on a good "Live Chat" plugin? (ugh)

snagger
Aug 14, 2004

fuf posted:

Any tips on a good "Live Chat" plugin? (ugh)

I'm keeping eyes out myself. Zopim works, even on the free tier. I want to experiment with intercom.io, and there's a plugin, but their live chat feature is new enough to where the plugin hasn't been updated to support it. Could install it manually, of course.

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.

jackpot
Aug 31, 2004

First cousin to the Black Rabbit himself. Such was Woundwort's monument...and perhaps it would not have displeased him.<
I bought a "managed wordpress" hosting plan from godaddy. Looking around, I'm feeling like I made a mistake, because I'm having a hell of a time finding a control panel of any kind. I know how to install wordpress (jesus, it's usually just an "install wp" button) - did I buy some kind of training wheels package that assumes I can't even do that part?

Did I make a mistake?

Dr. Fishopolis
Aug 31, 2004

ROBOT

jackpot posted:

I bought a "managed wordpress" hosting plan from godaddy. Looking around, I'm feeling like I made a mistake, because I'm having a hell of a time finding a control panel of any kind. I know how to install wordpress (jesus, it's usually just an "install wp" button) - did I buy some kind of training wheels package that assumes I can't even do that part?

Did I make a mistake?

Buying hosting from godaddy? Yes, you made a mistake.

There are a bunch of goon hosting deals in SA Mart that will be infinitely better in every way. I use vNucleus and am v. happy.

kedo
Nov 27, 2007

I need the ability to export posts in custom-formatted XML. I've toyed with a couple of plugins that allow you to export posts in various formats (none of which are quite what I'm looking for), but am wondering if there's perhaps an easier/better way to do it. Any ideas? Wondering if I'd be better off simply writing some PHP by hand that outputs XML.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Sorry if this is a dumb question, but is there a query string parameter I can pass in to a RSS feed to remove the pagination? Is there something like this:

https://www.myblog.com/mycategory/feed/?limit=0

Basically, I just want all of the posts for a certain category in one request. Thanks!

spiritual bypass
Feb 19, 2008

Grimey Drawer
I've been asked to add a new user to a site that I completed a couple weeks ago. I made an account and sent the credentials to the user. Done it a hundred times before; should be no problem. He replies with screenshots showing unknown username/email on both the login and forgot password pages.

To assess the situation, I try the forgot password feature with his email address. The site reports that it was sent. I try again with my own email and receive the forgot password link in my inbox immediately. He claims, however, that he never received the forgot password email I had sent to him, even in his spam folder.

The only things I can possibly imagine happening here are that either he's got a DNS problem (perhaps a hosts entry pointing to an old site?) along with with an email problem or that he's just lying to me for no clear reason. Am I overlooking any possibilities here? Are there any hiccups with Wordpress user registration I may have forgotten?

kedo
Nov 27, 2007

Are you sure he's trying to login on the right site? I can't tell you how many times I've seen users try to login on wordpress.com – their login screen is identical to a default WP install.

Also, are you positive he's using the right email address? Even if there were email problems, that shouldn't stop him from being able to login or form WP knowing that there's an account paired with the address. This sounds like a PEBCAK issue to me.

spiritual bypass
Feb 19, 2008

Grimey Drawer
I managed to talk him through nslookup and found out that his IT company has a special (and now incorrect) DNS record for the domain pointing to an old server that also happens to be running Wordpress. Fun!

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doh004 posted:

Sorry if this is a dumb question, but is there a query string parameter I can pass in to a RSS feed to remove the pagination? Is there something like this:

https://www.myblog.com/mycategory/feed/?limit=0

Basically, I just want all of the posts for a certain category in one request. Thanks!

I ended up by going into my theme's functions.php and adding the following (basically took the actual implementation of the RSS2 and added a check if its a category that I want to return more of:

code:
remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'expanded_feed_rss', 10, 1 );

function expanded_feed_rss($for_comments) {
    $category = get_query_var('cat');
    
    if ($category == numberICareAbout)
    {
            query_posts( 'post_type=post&posts_per_page=25&cat='.$category );
    }

    if ( $for_comments )
    {
		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
	}
    else
    {
		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
	}
}

simcole
Sep 13, 2003
PATHETIC STALKER
I have a friend who I setup a wordpress install for. He has some commercial real estate listings on his page with photo's and details. I want to make a plugin for him that he can type into text boxes and it will auto format the addition to the page.
Here is the page: http://www.memphisci.com/listings/
I dont know enough about Wordpress to know if plugins can do what I want or not. I've written code in several different languages, so I'm not scared to try. Can someone provide me some insight and direction?

my bony fealty
Oct 1, 2008

simcole posted:

I have a friend who I setup a wordpress install for. He has some commercial real estate listings on his page with photo's and details. I want to make a plugin for him that he can type into text boxes and it will auto format the addition to the page.
Here is the page: http://www.memphisci.com/listings/
I dont know enough about Wordpress to know if plugins can do what I want or not. I've written code in several different languages, so I'm not scared to try. Can someone provide me some insight and direction?

You can create a custom post type (or modify the default post type) with an input (like a text box), WordPress calls them meta boxes. Here's a good guide:

http://themefoundation.com/wordpress-meta-boxes-guide/

Creating a custom post type is a bit more involved but still fairly simple:

http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/

The idea being that WordPress loops through all of the posts and outputs them as formatted HTML to wherever you'd like them.

There are also plugins that will do it for you without coding, I haven't used them but I would imagine they work well enough:

https://wordpress.org/plugins/custom-post-type-ui/
https://wordpress.org/plugins/meta-box/

simcole
Sep 13, 2003
PATHETIC STALKER

my bony fealty posted:

You can create a custom post type (or modify the default post type) with an input (like a text box), WordPress calls them meta boxes. Here's a good guide:

http://themefoundation.com/wordpress-meta-boxes-guide/

Creating a custom post type is a bit more involved but still fairly simple:

http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/

The idea being that WordPress loops through all of the posts and outputs them as formatted HTML to wherever you'd like them.

There are also plugins that will do it for you without coding, I haven't used them but I would imagine they work well enough:

https://wordpress.org/plugins/custom-post-type-ui/
https://wordpress.org/plugins/meta-box/

Thank you. I'm confused slightly that the listings is a "page" and not a collection of posts. Do I need to set it up as posts somehow?

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'm using this theme and having trouble identifying the pagination and next link selector so I can use infinite scrolling. Any ideas?

huhu
Feb 24, 2006
Any thoughts: I'd like to split my website in half with an engineering portfolio part and a photography portfolio part. What would be the best way to do this? Could I run both parts separately from one WordPress installation? Should I add a second installation to my website?

my bony fealty
Oct 1, 2008

simcole posted:

Thank you. I'm confused slightly that the listings is a "page" and not a collection of posts. Do I need to set it up as posts somehow?

Yeah, that would be ideal. I'm guessing that the current setup has all of the HTML for the listings inside the big main content textbox for that page, which is a bit unwieldy (and will only get more so as more listings are added that way).

The idea being that each listing would be added as an individual post (which would contain the needed areas for input, e.g. address, contact, details, and an image), which is then fed into the WordPress Loop which outputs the posts as structured HTML. Here's a good intro to the WordPress Loop:

http://blog.teamtreehouse.com/wordpress-loop-beginners-guide

It doesn't go into detail about using custom meta box info in the loop, though, but it's pretty simple - if you create a meta box with an "$id" parameter of "listing_address", you can just tell the loop to look for that "listing_address" parameter and output its value. A loop through a custom post type would look something like this:

php:
<?php
    $args = array( 'post_type' => 'your_post_type''posts_per_page' => -);
    $your_post_loop = new WP_query$args );
    while ( $your_post_loop->have_posts() ) : $your_post_loop>the_post();
        echo '<div class="listing_box">';
        echo the_post_thumbnail();
         echo '<h3 class="address">';
        echo get_post_meta($post->ID"listing_address"true);
        echo '</h3>';
    endwhile;
?>

With a hypothetical styling class of "listing_box" for each listing elements, h3 with "address" class, and a meta parameter called "listing_address".

"the_post_thumbnail()" is WordPress' default for the "Featured Image" option that posts have, which is a useful way to insert an image into each post. The "posts_per_page" limits the number of posts that will be displayed, -1 means unlimited.

So, what I would do in your situation:
-Create a custom post type for listings (useful tool: http://generatewp.com/post-type/)
-Add the needed meta boxes to that post type
-Upload your post type php file as a plugin (and activate it)
-Set up a page template (your theme should have a page.php file that can be modified for this) with a loop to display the posts of your custom post type
-Create a page for the listings and select that template to use, and set this page as the front page (you might be able to just modify the front-page.php file, if the theme has it)

From here the user can add new posts from the backend and they will show up on the front page. It may be easier to just extend the default post type that comes with the WordPress installation with more meta boxes instead of creating a new post type, if you only need to add one kind of content.

Hopefully this is more helpful than confusing! Disclaimer that there are usually multiple ways to do things in WordPress, and my method is definitely not the only or ideal way to do it, but it's gotten the job done for similar stuff I've done with WordPress (letting a user add new photos to a gallery via custom post type, for example).

Disharmony
Dec 29, 2000

Like a hundred crippled horses lying crumpled on the ground

Begging for a rifle to come and put them down
How do I make the "Read More" button appear only for posts with more than 120 words?

snagger
Aug 14, 2004

Disharmony posted:

How do I make the "Read More" button appear only for posts with more than 120 words?

This plugin looks like it could help: https://wordpress.org/plugins/advanced-excerpt/screenshots/

the heat goes wrong
Dec 31, 2005
I´m watching you...

Disharmony posted:

How do I make the "Read More" button appear only for posts with more than 120 words?

Probably not 100% correct, but something along these lines, some themes do it differently. Add to functions.php:

function excerpt_length( $length ) {
return 120;
}
add_filter( 'excerpt_length', 'new_excerpt_length');


You could probably search for excerpt in your functions.php and replace the number with 120. Remember to use a child theme, otherwise all your changes will be lost when your theme updates.

Bradzor
Mar 18, 2007
Fwhaa?

Azur posted:

Probably not 100% correct, but something along these lines, some themes do it differently. Add to functions.php:

function excerpt_length( $length ) {
return 120;
}
add_filter( 'excerpt_length', 'new_excerpt_length');


You could probably search for excerpt in your functions.php and replace the number with 120. Remember to use a child theme, otherwise all your changes will be lost when your theme updates.

To avoid the problem of losing it on a theme update, just make a new PHP file in your plugins directory and add a plugin header to it. You also want to make sure you prefix your function, so that if a function named 'excerpt_length' exists, your site won't break.

code:
<?php
/*
Plugin Name: Modify Excerpt Length
Description: Changes the length of excerpts to 120 words.

function my_fancy_plugin_excerpt_length( $length ) {
   return 120;
}
add_filter( 'excerpt_length', my_fancy_plugin_'new_excerpt_length' );

Another fancy trick is to make a new folder inside of wp-content called 'mu-plugins', and any PHP files you put in here will automatically loaded. So you can just make a new PHP file with that line of code in there, no need for the plugin header.

Adbot
ADBOT LOVES YOU

fuf
Sep 12, 2004

haha
Why do people do theme updates?

Plugins and core updates of course, but once a site looks how you want it why would you update the theme and risk changing the appearance? Is it just in case the updates have new browser / device support?

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