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
NotShadowStar
Sep 20, 2000

Bubblegum Wishes posted:

Edit2: This is unrelated. Wordpress needs MySQL? Theres no way to get it to use a SQL server?

Thanks to the great design of PHP, unless you use some sort of database abstractor (almost nobody does) the database functions in PHP are actually named mysql_query, pg_execute, mssql_execute and the like.

I'm glad this is here, I've been looking at CMS type systems and finally settled on Wordpress because it's interface is so clean and it seems quite developer friendly, but it takes a while to figure out how to do things the Wordpress way. Like if you know Ruby but going to Rails is way different, or if you know Python and going to Django there's things that you need to learn.

Adbot
ADBOT LOVES YOU

NotShadowStar
Sep 20, 2000
If I have the ID of a user and need to look up information, is this the best way to do it? For example:

php:
<?
function generate_profile_link($uid){
  $first_name = get_the_author_meta('first_name', $uid);
  $last_name = get_the_author_meta('last_name', $uid);  
  $link = sprintf("<a href='/People/profile/%s' >%s, %s</a>", $uid, $last_name, $first_name);
  return $link;
}
?>

NotShadowStar
Sep 20, 2000

atastypie posted:

Is there a plugin that combines the javascript/css that all the other wordpress plugins install, so that there is only a single request for them? I hate it when a plugin includes the css inline below the header or when plugin javascript is loaded at the top of the page, instead of the bottom :(

It sounds like the plugin author is using script or style tags instead of wp_enqueue_script and wp_enqueue_stylesheet like it's supposed to. Those functions are meant to buffer in all of the stylesheets and javascripts so when the rendering chain hits wp_header() it'll print out everything.

tl;dr Wordpress already does this but the plugin or theme author didn't do it right. You could fix it actually by removing the tags in the plugin and doing something like this in the functions.php file

php:
<?
function add_javascripts() {
  wp_enqueue_script('jquery');
  wp_enqueue_script('jquery_roundcorners', WP_CONTENT_URL . '/themes/genetics/js/jquery.corners.js');
}

add_action( 'init', 'add_javascripts' );
?>
It's best you hook init so you're sure you enqueue the scripts before it hits wp_header(). Don't hook wp_header, it doesn't work.

NotShadowStar fucked around with this message at 14:03 on Aug 4, 2009

NotShadowStar
Sep 20, 2000
That won't work if the plugin uses html tags instead of the wordpress functions, which is most likely the problem.

NotShadowStar
Sep 20, 2000
e: gently caress me I forgot while(have_posts()). Big nevermind

NotShadowStar fucked around with this message at 18:04 on Aug 11, 2009

NotShadowStar
Sep 20, 2000

mynameischainsaw posted:

Anybody have favorite plugins for fostering a community? Looking specifically for a nice comments plugin or something.

Why not just use bbpress?

NotShadowStar
Sep 20, 2000
I'm working on exactly the same thing today. Hopefully I'll get it done today. I'll post it if I do.

NotShadowStar
Sep 20, 2000

SmirkingJack posted:

I think I've (almost) got it. I looked at the code for add_submenu_page(), which add_*_page (add_posts_page in my case) calls, and saw a global array called $_registered_pages. In my plugin I added the hookname (from get_plugin_page_hookname($file, 'edit.php')) to that array and I think it worked, but I haven't had a chance to really test it. Add some permissions checking and you should be good. Maybe.

Source for add_submenu_page():
http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-admin/includes/plugin.php.source.html#l660

Got it finished. It's up to you how you want to do it in a page.

main file:
http://pastie.org/589009

m/publication.php
http://pastie.org/589010

v/publication_form.php
http://pastie.org/589012

v/publication_table.php
http://pastie.org/589014

Ned: I make assumptions that $wpdb->update and ->insert auto-sanitizes, is that right?

(Oh wait I left a couple things finished. Whatever you get the point)

NotShadowStar fucked around with this message at 21:47 on Aug 19, 2009

NotShadowStar
Sep 20, 2000
Actually that page didn't say one or the other, it just said 'here they are'.

According to the Data Validation:

quote:

$wpdb->insert( $table, (array) $data )
$data should be unescaped (the function will escape them for you). Keys are columns, Values are values.
$wpdb->update( $table, (array) $data, (array) $where )
$data should be unescaped. Keys are columns, Values are values. $where should be unescaped. Multiple WHERE conditions are ANDed together.

So I think it does... I made that assumption because why would you use insert and update if it didn't sanitize?

NotShadowStar
Sep 20, 2000
You probably want get_categories() which gives you an array of categories, then array_rand().

NotShadowStar
Sep 20, 2000
Another quick way is to change the permalink structure in the admin panel and save. If you don't get any errors everything should work out. If it says it can't write .htaccess, then you need to change the permissions on your host like Ned linked to.

NotShadowStar
Sep 20, 2000
Something sounds pretty ridiculous but if you absolutely need to it the way you describe then you need to write a plugin. Wordpress plugins are designed around a series of hooks that allow you to execute your own PHP code when Wordpress hits a particular point in it's processing chain. Unfortunately I never could find a site that has the hooks in some sort of sequential order, so you'll need to find an appropriate hook before WP gets to the template cycle

http://codex.wordpress.org/Plugin_API

NotShadowStar
Sep 20, 2000
Ned would know more about the event chain but if it's too late to do what you're trying to do when Wordpress starts rendering templates files, from codex.wordpress.org:

init
Runs after WordPress has finished loading but before any headers are sent. Useful for intercepting $_GET or $_POST triggers.

So you'll want to hook init with the following as a plugin:

php:
<?
function my_awesome_function() { return 0 };
add_action('init', 'my_awesome_function');
?>
How to do it: http://codex.wordpress.org/Plugin_API

NotShadowStar
Sep 20, 2000
It looks like your HTML is very wrong. There's mismatched tags all over and mystyped closings. Whenever I have screwy cross-browser behavior the first thing I do is make it valid. That at least gets you a starting point if it doesn't fix it outright. Interestingly enough I believe that Firefox is more tolerant and guesses more from bad HTML than IE these days, go figure.

Note: if you use the dynamic sidebar (doesn't look like it but) your HTML won't completely validate as the WP devs added an HTML attribute in the dynamic sidebar that isn't in the standard yet.

NotShadowStar fucked around with this message at 06:11 on Oct 3, 2009

NotShadowStar
Sep 20, 2000
That is a strange problem.

What I'm talking about :

http://validator.w3.org/check?uri=h...lidator%2F1.654

NotShadowStar
Sep 20, 2000
Dude, come on:

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

NotShadowStar
Sep 20, 2000
I've used something like jQuery Corners, which allows you to specify through selectors what gets rounded. If the browser has native corner rounding it will use that, otherwise fall back to drawing its own corners (for IE)

NotShadowStar
Sep 20, 2000

supster posted:

Real estate listings was simply an example. And if you reread my post I'm not even asking how to do this in Wordpress, but if there is a nice clean way to do it as I'm unhappy with all of the approaches I've taken in the past.

You can use the stuff I posted earlier for managing publications on a content-based website as a basis. It adds a control panel in the admin interface, and you need to create a custom page to spit out the content how you want it. Problem being, PHP is kind of a poo poo language and Wordpress doesn't help you much outside of Wordpress database functions, so you end up doing a lot of work.

NotShadowStar
Sep 20, 2000
You might try a WP backed content site and have a Django-powered listing in a subdomain or sub-uri if you know how, and give your users access to the Django control panel which is really quite awesome. Its two separate systems, but probably a whole lot less work for you.

NotShadowStar
Sep 20, 2000
I just hit that the other day:

http://codex.wordpress.org/Customizing_the_Read_More#Link_Jumps_to_More_or_Top_of_Page

NotShadowStar
Sep 20, 2000
I never did figure this one out. Is there a more elegant way of linking to an image included in the theme rather than

php:
<?
<img src="/wp-content/themes/clownfarts/images/clownbutt.png" alt="effu" />
?>

NotShadowStar
Sep 20, 2000
Simple: what's a good AdSense plugin? The ones I'm finding through the plugin manager have okay-ish ratings whatever that's worth. Preferably widget-based so I can just drop a widget to a widget area.

NotShadowStar
Sep 20, 2000
I've been using Advertising Manager which seems okay. The Analytics plugins I've been used to using had nice interfaces that just needed your Analytics ID and the rest you can control right through the control panel.

I'm really new to the whole 'making money on your website through ad traffic' thing. Absolutely everything else I've done before has some sort of internal purpose or a supplement to an existing thing, so this is all really new and weird to me. And impossible to find information on with lots of searches going to site like http://make-money-with-your-google-flaccid-seo.br.info/YOU_WON_A_HOG.cfm

NotShadowStar
Sep 20, 2000
Working on a site where I'm doing a sub-theme of twentyten. It's 1/2 content (thousands of pages) and 1/2 blog. The sidebar will be the same across the whole site for the most part, but for blog pages I want to show archives, subscription links widgets and all that. The best way I can think of is putting all of the widgets I want to show everywhere in Widget Area 2, and the ones I want in just for post areas in Widget Area 1, then create a sidebar.php that detects if it's a page or a post and displays the widget areas accordingly. That seems more complicated than it should be though, is there a better way?

Adbot
ADBOT LOVES YOU

NotShadowStar
Sep 20, 2000
This is more Drupal specific, but Wordpress has a lot of the same challenged and the community is much more active, so I'll ask here.

What are some strategies for developing a site with a small team? After WP3 it's not as much as an issue, but before that many of the queries, functions and templates only work by ID. For instance for the longest time if you wanted to have a special page template for a particular page you had to create a page-id.php. So a copy of the DB must be sync'd throughout the project. That's pretty bad for development though. Say one developer does a bunch of stuff on their own, commits a copy of the code and the DB to the repository. Another developer is working independently on a different project but interrelated dependencies. They do work and push it back, but the database could be different.

Drupal has more complex problems but if people have ideas on how they dealt with it in Wordpress that could spark some ideas. The php files generally aren't a problem, it's centralizing database information in a way that can be propagated safely. Right now I'm completely at a loss.

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