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
Bradzor
Mar 18, 2007
Fwhaa?

sniperchance posted:

Are there any WP plugins that allow you to restrict both frontend and dashboard access to certain post categories based on user capabilities? For example, making posts within a "Secret" category that only Editors and above can view and edit.

I'm not sure if there are any plugins out there, but it would be really easy to do this. Make a template for the category, and wrap the loop of it with a check for that user type.

if (current_user_can('editor')) {
//here's where the output of posts is
}

Adbot
ADBOT LOVES YOU

Bradzor
Mar 18, 2007
Fwhaa?

Gyshall posted:

Any blank lines at the end of your functions.php file?

Just goes to show, kids, don't close your PHP tags at the ends of files.

Bradzor
Mar 18, 2007
Fwhaa?
By default, WordPress should embed youtube videos using oEmbed - just make sure the link is unformatted and on its own line in the editor. Works with vimeo, youtube, and tons of other providers.

Bradzor
Mar 18, 2007
Fwhaa?

kedo posted:

Put a unique string of characters in a comment on each template file, then view source.

There may be some more WordPressey way to do it, but :effort:

e: Also assuming the site is constructed in a logical manner, you should be able to narrow it down beforehand so you only have do that on a few files.


e2: Googled

code:
global $wp_query;

$template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true );
apparently works.

Debug and the plugins that add to it are the best way to go. Will give you ALL THE INFOS.

Bradzor
Mar 18, 2007
Fwhaa?

gmq posted:

This. Creating custom fields by hand is tedious.

And https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress is almost the exact same thing is ACF, but with code instead of a GUI.

Bradzor
Mar 18, 2007
Fwhaa?

thegasman2000 posted:

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

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

Bradzor
Mar 18, 2007
Fwhaa?

Chris! posted:

Hey, this is a really simple thing but I've had a long day and my brain feels dead.

Say I have 3 parts on my hypothetical site. "Clothes", "Cars" and "Weapons".

Users can publish posts, and can choose a category for those posts. For example, "tee shirts" or "grenades". They can upload as many images as they like to that post, via advanced custom forms' gallery. The posts are then displayed as "latest cool poo poo", and can be filtered by specific category (show all grenades! Show all Ferrari's!)

What I then want to do is have a new page, "Gallery of all weapons", and display any images uploaded to any post that is under the banner of "Weapons" (anything uploaded as grenades, machetes, knuckle-dusters etc). There will only be 3 or 4 types of weapons allowed.

How can I say, on the Weapons page, "display anything uploaded to a post of these specific categories (i.e. show any grenades, machetes or knuckle dusters on this page"?

Notes: I'm not really making a website for a clothes, cars and weapons distributor, the actual industry is way too boring to use as an example. Also I know I've done this exact thing before I'm just really tired and can't figure out how to do it now.

The easiest way would be to make clothes, cars, and weapons three separate taxonomies, I'd say.

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

Bradzor
Mar 18, 2007
Fwhaa?

fuf posted:

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?

Themes include more than just HTML/CSS, most theme updates are bugfixes, security updates, more functionality, etc

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