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
rugbert
Mar 26, 2003
yea, fuck you
Im making my very first theme using the settings API and was hoping someone can direct me to a couple tutorials.

Im looking to:
one - make my own media uploader to upload a bunch of images to use as a image slider on my homepage
two - make my own widgets page so users can customize the theme's footer.

Has anyone seen any tutorials like these?

Adbot
ADBOT LOVES YOU

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.
Adding widgets to a theme isn't difficult. You specify the widget areas you want in your functions.php and then place those widgets wherever they're supposed to go in the appropriate theme template (sidebar, footer, whatever).

http://codex.wordpress.org/Function_Reference/dynamic_sidebar

See also register_sidebar and the like, which can be found in the "related" section of that codex page.

rugbert
Mar 26, 2003
yea, fuck you

Heresiarch posted:

Adding widgets to a theme isn't difficult. You specify the widget areas you want in your functions.php and then place those widgets wherever they're supposed to go in the appropriate theme template (sidebar, footer, whatever).

http://codex.wordpress.org/Function_Reference/dynamic_sidebar

See also register_sidebar and the like, which can be found in the "related" section of that codex page.

I mean, I've made a settings page/section for my theme and one of the pages wil lbe for footer settings. I was thinking about it and I think it would be cool if I just made a bunch of widgets and let the user drag them to where they want them on the footer. So basically the widgets page but I'd like to make a customized one.

every
Apr 24, 2008

I have a weird .htaccess / WordPress issue.

I'm running two Wordpress sites on my HostGator account. Each site's files are in separate subdirectories of the root eg /site1 and /site2. I'm using .htaccess to forward to each directory based on the request domain:

code:

# pointing for the domain site1.com to folder site1
RewriteEngine On
RewriteBase /
ReWriteCond %{HTTP_HOST} site1.com
ReWriteCond %{REQUEST_URI} !site1/
ReWriteRule ^(.*)$ site1/$1 [L]  

# pointing for the domain site2.com to folder site2
RewriteEngine On
RewriteBase /
ReWriteCond %{HTTP_HOST} site2.com
ReWriteCond %{REQUEST_URI} !site2/
ReWriteRule ^(.*)$ site2/$1 [L]  

Unfortunately, the CSS and JS are 404ing on one of the sites. I've tried switching the order in .htaccess and some other silly little things, but no luck. Does anyone know what might be happening? Thanks!

edit:

Looks like I had to redirect everything in my wp-content directory separately? I don't know if this is "the right way" to do it, but its working as far as I can see:

code:
# pointing for the domain site1.com to folder site1
RewriteEngine On
RewriteBase /
ReWriteCond %{HTTP_HOST} site1.com
ReWriteCond %{REQUEST_URI} !site1/
ReWriteRule ^(.*)$ site1/$1 [L]

#ADDED THIS STUFF HERE
ReWriteCond %{HTTP_HOST} site1.com
RewriteRule ^wp-content/(.*)$ /site1/wp-content/$1 [L]

# pointing for the domain site2.com to folder site2
RewriteEngine On
RewriteBase /
ReWriteCond %{HTTP_HOST} site2.com
ReWriteCond %{REQUEST_URI} !site2/
ReWriteRule ^(.*)$ site2/$1 [L]

every fucked around with this message at 17:09 on Aug 7, 2012

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.

rugbert posted:

I mean, I've made a settings page/section for my theme and one of the pages wil lbe for footer settings. I was thinking about it and I think it would be cool if I just made a bunch of widgets and let the user drag them to where they want them on the footer. So basically the widgets page but I'd like to make a customized one.

You don't have to do anything. Just define the widget area, put it in a template, and it will automatically show up in the widgets section of the admin panel as another place you can customize. Support for multiple widget areas (aka "sidebars") is built into WordPress.

the kawaiiest
Dec 22, 2010

Uguuuu ~

Heresiarch posted:

You don't have to do anything. Just define the widget area, put it in a template, and it will automatically show up in the widgets section of the admin panel as another place you can customize. Support for multiple widget areas (aka "sidebars") is built into WordPress.

I think he wants a separate widgets page for this one specific thing as opposed to having a widget area in the admin page along with all the others. I personally think that's unnecessary but if that is indeed what he wants then he will have to make a theme options page and code a separate widgets section just for his theme. I've seen this in some themes and it always annoyed the crap out of me though. Like, just let me control all of the widgets from a single page please. Having them all over the place is confusing.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
This is a long shot, and I'm probably not phrasing it correctly, but our site is dealing with two basic types of posts which are defined by categories. Is it possible to have a link on the front page that a user clicks on which will take them to the post form with one of the two categories pre-selected? If not then is there some sort of built-in or plugin support for this type of behavior?

slartibartfast
Nov 13, 2002
:toot:
I'm having trouble Googling for this one, and I'm hoping somebody has encountered this before. I'm looking for a widget that will allow for searching posts of a particular type by their taxonomies.

Two for examples of what I'm hoping to achieve: http://www.cocosuites.com/en/suites/Spain/Barcelona and http://sua.umn.edu/reservations/ (enter as a guest, then filter rooms by attributes)

Complicating matters is that for my purposes, these controls will all search against custom taxonomies or custom fields attached to a particular custom post type. It seems like I need some kind of AJAX search widget that can fire wp_query() with whatever search parameters exist.

Does something like this exist already? Or do I need to dust off my AJAX/PHP?

rugbert
Mar 26, 2003
yea, fuck you

the kawaiiest posted:

I think he wants a separate widgets page for this one specific thing as opposed to having a widget area in the admin page along with all the others. I personally think that's unnecessary but if that is indeed what he wants then he will have to make a theme options page and code a separate widgets section just for his theme. I've seen this in some themes and it always annoyed the crap out of me though. Like, just let me control all of the widgets from a single page please. Having them all over the place is confusing.

Exactly. Can you link me to some sample themes that do this? I dont want to annoy anyone but youre probably a seasons wordpress user so you know whats up, Im just trying to logically group all my settings together.

the kawaiiest
Dec 22, 2010

Uguuuu ~

rugbert posted:

Exactly. Can you link me to some sample themes that do this? I dont want to annoy anyone but youre probably a seasons wordpress user so you know whats up, Im just trying to logically group all my settings together.
You know, now that I think of it, I was thinking of drag and drop frameworks and not regular themes. I'm not sure if it's actually possible to have a separate widgets page.

Atahualpa is a regular theme which has too many loving options, and one of them is to let the user add new widget areas to the theme. Those will still show up on the default widgets page though.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
I'm designing a static homepage right now with images in the design. Where am I supposed to point my image sources towards? I've tried putting them in the same directory as the file and the images directory and it doesn't show up in either one. Some stuff on the codex suggests that you're supposed to make everything an absolute path name... there's no way that's right, is it?

edit: Nevermind, I temporarily forgot that the page is actually being rendered from the main directory of the site, not the directory that the theme files are in. Putting in the wp-content/themes/theme-name/file.png worked.

sector_corrector fucked around with this message at 22:40 on Aug 8, 2012

fac53
Oct 22, 2002
At last! A dead star!

sector_corrector posted:

I'm designing a static homepage right now with images in the design. Where am I supposed to point my image sources towards? I've tried putting them in the same directory as the file and the images directory and it doesn't show up in either one. Some stuff on the codex suggests that you're supposed to make everything an absolute path name... there's no way that's right, is it?

edit: Nevermind, I temporarily forgot that the page is actually being rendered from the main directory of the site, not the directory that the theme files are in. Putting in the wp-content/themes/theme-name/file.png worked.

PROTIP: Use <?php bloginfo('template_url'); ?> to generate the path to your template theme instead of typing the whole thing out every time.

clockworkjoe
May 31, 2000

Rolled a 1 on the random encounter table, didn't you?
Is there an easy way to disable multisite? I have a site that used to be MU but I've realized it should just be one blog - not a multisite. I found some tutorials but they were all from 2010 so I wonder if there's a better way to do it now.

This is the site BTW http://community.roleplayingpublicradio.com/

lunar detritus
May 6, 2009


clockworkjoe posted:

Is there an easy way to disable multisite? I have a site that used to be MU but I've realized it should just be one blog - not a multisite. I found some tutorials but they were all from 2010 so I wonder if there's a better way to do it now.

This is the site BTW http://community.roleplayingpublicradio.com/

Apparently they still work, this message from a week ago from support at the WP forums points to a 2010 tutorial.

Stealthgerbil
Dec 16, 2004


I have been trying to find a decent downloader plugin for wordpress but search for downloader or any related words brings up a million plugins.

Essentially I am looking for a plugin that allows me or other people to upload a file to be approved. Once the file is approved, it would be downloadable to the public. It also needs to have some sort of rating system and a comments system.

Was wondering if anyone has any suggestions on a good plugin for this purpose?

mmm11105
Apr 27, 2010
I'm working on a site (for a goon) where the posts will be mostly by one off contributing authors (submited writing to our editors). What would the best way to be able to write a value into the author field of a post without having to create an account for every contributor? Preferably while keeping the author archive, and other author based features.

lunar detritus
May 6, 2009


mmm11105 posted:

I'm working on a site (for a goon) where the posts will be mostly by one off contributing authors (submited writing to our editors). What would the best way to be able to write a value into the author field of a post without having to create an account for every contributor? Preferably while keeping the author archive, and other author based features.

Custom field.

Then, make the post template check and display that custom field if it has it instead of the real author.

Finally, make it link to a custom archive that processes that query and shows posts with the same meta_value. Create the new rewrite rule for the custom archive with WP_Rewrite.

mmm11105
Apr 27, 2010

gmq posted:

Custom field.

Then, make the post template check and display that custom field if it has it instead of the real author.

Finally, make it link to a custom archive that processes that query and shows posts with the same meta_value. Create the new rewrite rule for the custom archive with WP_Rewrite.

So my current plan of using advanced custom fields (for the prettiness) isn't far off. Honestly, all I need from the archive is a paginated list of articles, so I might just make one as a custom post type.

rugbert
Mar 26, 2003
yea, fuck you

the kawaiiest posted:

You know, now that I think of it, I was thinking of drag and drop frameworks and not regular themes. I'm not sure if it's actually possible to have a separate widgets page.

Atahualpa is a regular theme which has too many loving options, and one of them is to let the user add new widget areas to the theme. Those will still show up on the default widgets page though.

Hmm ok thanks!

So Im about to make a wordpress site that has a member section and a discussion forum. Before I start searching around for plugins and tutorials for how to accomplish this feat does anyone have any suggestions?

So Ill need something to lock down the members only pages/sections and then a good forums plugin.

rugbert fucked around with this message at 18:38 on Aug 10, 2012

lunar detritus
May 6, 2009


rugbert posted:

Hmm ok thanks!

So Im about to make a wordpress site that has a member section and a discussion forum. Before I start searching around for plugins and tutorials for how to accomplish this feat does anyone have any suggestions?

BuddyPress or bbPress?

mmm11105
Apr 27, 2010
Another quick question. So the article page in my theme has an area that displays a custom field. When I click that area, I want to link to another page I have, but I also want to provide that page with the value of that field. As a wordpress newb, what is the best way to pass values between pages? Should I just append the vale as a GET parameter to the url, or is there a wordpressy way to do it.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo

rugbert posted:

Hmm ok thanks!

So Im about to make a wordpress site that has a member section and a discussion forum. Before I start searching around for plugins and tutorials for how to accomplish this feat does anyone have any suggestions?

So Ill need something to lock down the members only pages/sections and then a good forums plugin.

I'm working with BuddyPress right now, and it's decent.

Stealthgerbil
Dec 16, 2004


I set up a multisite wordpress installtion and it works fine but I can't seem to figure out how to change it to use a subdomain instead of a subdirectory. I tried to follow a tutorial but i wasn't sure how to set up a wildcard DNS entry.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
I think I'm totally misunderstanding how to limit the loop by category...

So I have,

code:
<?php
	$posts = get_posts(array('category' => 4, 'posts_per_page' => 10));
?>
<?php while (have_posts()) : the_post(); ?>
This successfully limits the loop to only category 4, but it also only displays a single post on the page. I've also tried the argument numberposts, but that doesn't work either. Am I putting this in the wrong place, or just totally misunderstanding the codex article that was posted earlier?

Gyshall
Feb 24, 2009

Had a couple of drinks.
Saw a couple of things.
Are you putting that loop in a page? Or in it's own loop.php?

sector_corrector
Jan 18, 2012

by Nyc_Tattoo

Gyshall posted:

Are you putting that loop in a page? Or in it's own loop.php?

It's a custom page-whatever.php, based off of the index.php file of my parent theme, just with the category restriction code inserted in above where the loop starts.

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.
If you're making a custom page for a particular category, you don't have to do anything that special. Just make a "category-[whatever].php" file, with a normal loop in it, possibly one that's got a custom amount of results.

Here's one from a theme I put together for an artist site, which shows thirty posts (because that's different from the usual amount shown) from a particular category, with thumbnails. This file was named "category-images.php" and it's automatically called by WordPress when somebody chooses the category "images" from a list of categories.

code:
<div class="post-content category-images"
<?php $posts = query_posts($query_string . '&orderby=date&showposts=30'); ?>
<?php if(have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail('bigthumb'); } ?>
</a>
<?php endwhile; else: ?>
<?php endif; ?>
</div> <!-- end .post-content -->
Note that there's nothing in the query string to restrict it to that category, because that's done automatically.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
Cool, I'll give that a try.

edit: That gives me a really strange page where it displays a single post from the category infinitely (like it continues rendering the same post over and over until I hit stop in my browser).

I feel like I'm missing a lot about building a loop successfully, and the Codex isn't really helping. Is there another good guide online that will help me be less stupid about this?

sector_corrector fucked around with this message at 18:05 on Aug 13, 2012

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.

sector_corrector posted:

edit: That gives me a really strange page where it displays a single post from the category infinitely (like it continues rendering the same post over and over until I hit stop in my browser).

You've got something out of order. I've seen that happen myself. I think it happens when you swap the "if(have_posts())" and "query_posts" parts, but I don't know for sure.

There's very simple loop examples here if you haven't seen it already. You might also try finding a "blank" theme, one designed as a starting place for other themes, and see how it works.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
OK, maybe it'd just be easiest to post the code I'm working with...

code:
<?php get_header(); ?>

<div id="content">
<div class="padder">

<?php do_action( 'bp_before_blog_home' ); ?>

<?php do_action( 'template_notices' ); ?>

<div class="page" id="blog-latest" role="main">

<?php if ( have_posts() ) : ?>

<?php bp_dtheme_content_nav( 'nav-above' ); ?>
<?php $insp = array('cat' => 4, 'numberposts' => 5, 'offset' => 0, 'orderby' => 'post_date');
$posts = get_posts($insp); ?>
<?php while (have_posts()) : the_post(); ?>

<?php do_action( 'bp_before_blog_post' ); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="author-box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
<p><?php printf( _x( 'by %s', 'Post written by...', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ); ?></p>

<?php if ( is_sticky() ) : ?>
<span class="activity sticky-post"><?php _ex( 'Featured', 'Sticky post', 'buddypress' ); ?></span>

That's the first half of the page. Am I putting the category limiting code in the wrong place? Messing up some basic PHP thing? At the moment it's sort of working, insofar as it's limiting to the right category, but it's not working insofar as it's only displaying a single post from the category. I'm using the code from http://codex.wordpress.org/Template_Tags/get_posts that codex page as reference.

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.
I believe you have things out of order, yes. Removing all of the code that isn't stuff relating to flow control:

code:
<?php if ( have_posts() ) : ?>

<?php $insp = array('cat' => 4, 'numberposts' => 5, 'offset' => 0, 'orderby' => 'post_date');
$posts = get_posts($insp); ?>

<?php while (have_posts()) : the_post(); ?>
If I understand what you're trying to do, it needs to be in this order instead:

code:
<?php $insp = array('cat' => 4, 'numberposts' => 5, 'offset' => 0, 'orderby' => 'post_date');
$posts = get_posts($insp); ?>

<?php if ( have_posts() ) : ?>

<?php while (have_posts()) : the_post(); ?>
That's assuming your query is set up correctly. When I need a custom query, I usually use code that looks something like this, instead, since I personally find it easier to read:

code:
<?php $posts = query_posts($query_string . '&orderby=date&showposts=30'); ?>

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

<?php the_content(); ?>

<?php endwhile; endif; ?>
But it's all basically the same idea.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
:/ Nope, still not working. I have no idea what I'm doing wrong.

I remember at one point I was trying some stuff out for the first page and had restricted the number of posts on the front page to 1 post via the dashboard - would that setting be taking effect on other instances of the loop?

Heresiarch
Oct 6, 2005

Literature is not exhaustible, for the sufficient and simple reason that no single book is. A book is not an isolated being: it is a relationship, an axis of innumerable relationships.

sector_corrector posted:

:/ Nope, still not working. I have no idea what I'm doing wrong.

I remember at one point I was trying some stuff out for the first page and had restricted the number of posts on the front page to 1 post via the dashboard - would that setting be taking effect on other instances of the loop?

If you've messed up your query string, then yes. The problem may be that you've used "numberposts" instead of "showposts". Since (I think) "numberposts" isn't a valid query value, then (I think) WordPress is using the default value instead.

Actually, I just looked, and I think my use of "showposts" in a query is wrong, too. According to this it's "posts_per_page". I will have to go double-check my own code now.

sector_corrector
Jan 18, 2012

by Nyc_Tattoo
Holy poo poo! I figured it out. I ended up using this method:

code:
global $post;
$my_pages = get_posts('numberposts=6&cat=7');
foreach ($my_pages as $post ) : setup_postdata($post);
	// post formatting goes here
endforeach;
wp_reset_postdata();
found at http://themeshaper.com/forums/topic/multiple-loops-demystified.

That all goes inside of the while loop for having posts. Thanks for the help everyone.

el Brainvomito
Dec 30, 2008

by T. Finninho
Is it okay to ask help for searching an appropriate plugin? I've been trying to look for a plugin that would slice the content on several pages, like something similar what they have in Gamasutra for way long articles. The problem is that I don't know the right words developers use for this feature.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

el Brainvomito posted:

Is it okay to ask help for searching an appropriate plugin? I've been trying to look for a plugin that would slice the content on several pages, like something similar what they have in Gamasutra for way long articles. The problem is that I don't know the right words developers use for this feature.

Pagination, I believe. Can't help you as far as recommending a specific plugin, but I'm sure there's something out there.

lunar detritus
May 6, 2009


el Brainvomito posted:

Is it okay to ask help for searching an appropriate plugin? I've been trying to look for a plugin that would slice the content on several pages, like something similar what they have in Gamasutra for way long articles. The problem is that I don't know the right words developers use for this feature.

WordPress does it natively with the <!--nextpage--> quicktag.

epswing
Nov 4, 2003

Soiled Meat
stupid question

epswing fucked around with this message at 05:14 on Aug 22, 2012

el Brainvomito
Dec 30, 2008

by T. Finninho

gmq posted:

WordPress does it natively with the <!--nextpage--> quicktag.
I had no idea I thought the whole thing so complicated way, thanks!

Adbot
ADBOT LOVES YOU

rugbert
Mar 26, 2003
yea, fuck you
Im making a php driven stylesheet with variables saved using the settings API but Im not sure how to properly use the stylesheet in my theme.

I've made my custom.php file (which my stylesheet with a .php extension) and added this code

Here is my custom.php:
code:
    <?php 
    header("Content-type: text/css"); 
    ?>
    div{background-color:<?php echo "red" ?>;} //just for testing purposes, Ill add some php variables from settings API here soon
and my functions.php file has this:
code:
	$root=get_bloginfo('template_directory'); 
	wp_enqueue_style("custom", $root."/styles/custom.php");	
So the custom.php file should be rendered as a stylesheet right? But my wordpress site doesnt load the file contents. When I look at the source code via firebug and expand the custom.php file all I see is:
code:
    Reload the page to get source for: [url]http://samsung/wordpress/wp-content/themes/kjd/styles/custom.php?ver=3.4.1[/url]
This is on my dev machine running Ubuntu 12.04, LAMP and Wordpress 3.4.1

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