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

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

Adbot
ADBOT LOVES YOU

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
I have another headache I've been fighting with...maybe you guys can help.

I want to put a text link to add a url to Instapaper. They provide an api (http://bit.ly/FKx0p) and a bookmarklet (http://bit.ly/14gEww), which is accessible through a plugin (http://bit.ly/S2POI).

However, the plugin is an iframe showing a graphic. I tried to match it style wise, but the iframe fucks it up (http://bit.ly/spD5 - below each excerpt).

Anyway, point is that I'd like to pass the permalink to Instapaper through a normal href. The code below *almost* works, except that it doesn't add the url - a minor problem as you can imagine.

code:
<a href="http://www.instapaper.com/b?v=4&k=USER_KEY&u=<?php echo urlencode(get_permalink()); ?>">read later</a>
The 'https://www.instapaper.com/api/add' part of the api he provides wont work since I dont have the users user/pass and it won't accept them with no values (returns a 403).

Anyone want to see if they can make this work using the info above? I wasted hours on it yesterday and cant get a response from the developer (which is cool, it's not his problem).

hmm yes
Dec 2, 2000
College Slice

NotShadowStar posted:

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.

Thanks. This is an easy to follow solution and I won't have any problems modifying the few plugins that step out of line like this.

Ned
May 23, 2002

by Hand Knit

pipebomb posted:

code:
<a href="http://www.instapaper.com/b?v=4&k=USER_KEY&u=<?php echo urlencode(get_permalink()); ?>">read later</a>
Anyone want to see if they can make this work using the info above? I wasted hours on it yesterday and cant get a response from the developer (which is cool, it's not his problem).

Can you shove the post id into get_permalink()?

jink
May 8, 2002

Drop it like it's Hot.
Taco Defender

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 :(

You can check out WP Minify, which will join all JS into one file and minify the contents. The plugin also joins CSS.

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.

SmirkingJack
Nov 27, 2002
Ok, I have adjusted the permalinks so urls look like http://www.myblog.com/categoryname/postname and I can view all posts in a category by going to http://www.myblog.com/categoryname/. Awesome.

Say I have the following category structure:

code:
Category1
	Subcat1
	Subcat2
        ...
	SubcatN
How can I hijack the category listing (from http://www.myblog.com/categoryname/) so rather than the default display of posts it lists the posts in each sub-category and looks like the following:

Category1

Subcat1
  • Posttitle1
  • Posttitle2
  • Posttitle3
Subcat2
  • Posttitle4
  • Posttitle5
  • Posttitle6
SubcatN
  • PosttitleN+1
  • PosttitleN+2
  • PosttitleN+3

Edit: Nevermind, I found category templates which tells me how to do it.

SmirkingJack fucked around with this message at 15:41 on Aug 7, 2009

mynameischainsaw
Aug 12, 2008
Does anybody have experience using easy php calendar with wordpress? It's not supported, but it works. I was wondering if anyone used it or a more robust calendar often.

Edit: Also what about a plugin that can make a widget to display the latest posts from other blogs we read? I was trying to find a way to use google reader to do this but there's got to be an easier way...

mynameischainsaw fucked around with this message at 05:03 on Aug 11, 2009

teeripp
Jan 20, 2006
Me and a friend are looking to implement a unique concept for a content website... the site will initially cover music but would have potential to branch out to other areas. The content and planning will be done by us; however, we need help with creating the site. We would like to start with a wordpress format and already have an idea for the layout. Anyone?

Obviously we will compensate for your efforts. PM or email trippmostertz(at)gmail.com if you're interested.

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

LuckySevens
Feb 16, 2004

fear not failure, fear only the limitations of our dreams

cross posting this from the php thread, it would probably go better here anyway:

Actually I change my question, I managed to find a wp plugin which does the job nicely, the only problem now is getting the category image to format nicely with the blog post text. When I put the functions together:

code:
  <?php if (function_exists('get_cat_icon')) get_cat_icon("class=myicons"); ?>

<?php  the_content('[Read more &rarr;]');  ?> 
On the same line, it just places the image above the blog text. I'd like it to do a nice text wrap around for the get_cat_icon() image, I've tried to play around with the CSS but no luck, I've tried doing a few mods to how the plug in posts the <img> tags but no luck, I assume its some basic php knowledge that I'm missing that stops me from doing this.

Edit: In case its needed, documentation on the function from the plugin here

Ned
May 23, 2002

by Hand Knit
Your issue is probably the fact that your content comes out with p tags. In order to shove it into the actual content you'd have to apply a filter that appends the image right after the first p tag opens so that the text wraps around the image inside of the p.

KuruMonkey
Jul 23, 2004
Floating the image will usually have the effect you ask for. So fix in CSS.

Edit: check there's no clear: on the paragraph(s) in question.

SmirkingJack
Nov 27, 2002
I was already pretty impressed with WordPress as a user, but now that I have started tweaking themes and writing plugins I can appreciate the thought and planning that went into it. I wouldn't quite say that it is intuitive, but maybe it's just that my style differs from the devs'.

Anyway, does anyone know of a plugin that can analyze a post and automatically generate tags for it? The end goal is to generate a big ol' word cloud and all the existing cloud plugins seem to be tag based.

Trakke
May 3, 2009

by Ozma
Alright, here is my situation. I installed Wordpress on my domain (Dreamhost hosting) and it was working fine (at my domain/blog) until I tampered with the php and hosed the whole thing up. I decide to delete the (/blog) directory and re-install Wordpress via the Dreamhost "One click install" method. To my knowledge I am unable to delete this directory for some loving reason and cannot re-install Wordpress again. Somebody please remote assistance with me to fix this loving bullshit. Thank you.

mynameischainsaw
Aug 12, 2008
Anybody have favorite plugins for fostering a community? Looking specifically for a nice comments plugin or something.

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?

Ned
May 23, 2002

by Hand Knit
There is also BuddyPress for WordPress MU and Intense Debate. But I think bbPress is probably the best solution because I think forums are best for community. Comments are better for reaction.

Sterf
Dec 31, 2004

Or Simple Press Forum. A forum but can auto create a thread per article and let the forum posts appear as comments underneath the article too.

Manny
Jun 15, 2001

Like fruitcake!
Do you Wordpress pros have a favourate 'blank' template to start from or do you start writing from complete scratch?

I ask as I'm trying to theme my own blog. Most of my skills are in photoshop, with a pretty good knowledge of xhtml/css and a pretty vague knowledge of php. So I'm using the Thematic framework as starting point, and making my own child theme on top of that.

I'm just seriously lost in this land of templates. As a basic starting point I'm just trying to put a logo graphic alongside the title, but I can't find which file I need to edit. Logic dictates it's in header.php but all that gives up is this

code:
    <div id="header">
        <?php thematic_header() ?>
    </div><!-- #header-->
And I can't find where the hell thematic_header() is. Is there a simpler theme or tutorial for a beginner to look at?

Ned
May 23, 2002

by Hand Knit
thematic_header() is in /library/header_extensions.php

I don't know if it is a good idea to try and develop a new theme based on thematic until you understand what thematic actually does. It is probably easier to start building off of the kubrick theme.

Manny
Jun 15, 2001

Like fruitcake!
Thanks. I decided I was going all about it the wrong way anyway. Doing a proper mockup in PS now, then I'll make it in HTML, then I'll pick apart the default theme and get things working in mine.

Edit:
http://sectiondesign.co.uk/blogdesign1.png

Where I'm at so far. Any suggestions or things that could look problematic to implement?

Manny fucked around with this message at 23:41 on Aug 18, 2009

Ned
May 23, 2002

by Hand Knit

Manny posted:

Thanks. I decided I was going all about it the wrong way anyway. Doing a proper mockup in PS now, then I'll make it in HTML, then I'll pick apart the default theme and get things working in mine.

That is usually the process I use. Just try to keep your markup for the post related stuff the same way the default theme likes to spit things out and you will be in good shape.

LuckySevens
Feb 16, 2004

fear not failure, fear only the limitations of our dreams

KuruMonkey posted:

Floating the image will usually have the effect you ask for. So fix in CSS.

Edit: check there's no clear: on the paragraph(s) in question.

Gotta love it when a simple solution works first time. Thanks for the point in the right direction!

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Envato has a wp/css/script/cs bundle going on - several templates for $20: http://envato.com/birthday/

SmirkingJack
Nov 27, 2002
I am writing a plugin to manage a new type of content called publications. I have added two items to the Posts menu, add and manage, that call a script - add.php and manage.php respectively. Manage.php lists all of the publications and for each one it provides a button to edit it. This works.

However, when the edit button is clicked, it calls a function that redirects the user to a third page, edit.php. Well, it is supposed to do that. Instead of arriving at edit.php, it stops and tells me, "You do not have sufficient permissions to access this page." If I add an edit submenu to Posts (or anywhere else), it redirects without a problem. However, I don't want this because I need editing to be initiated from manage.php

My question is, is there a way of "registering" this edit.php page with WP and setting the permissions level without adding it to a menu? Or otherwise accomplish the same goal?

SmirkingJack fucked around with this message at 14:07 on Aug 19, 2009

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.

SmirkingJack
Nov 27, 2002

NotShadowStar posted:

I'm working on exactly the same thing today. Hopefully I'll get it done today. I'll post it if I do.

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

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Anyone know of a plugin that will show me wordpress related errors? For instance, I have a plugin that occasionally fails and I dont know why. If I had something that logged errors I could maybe find out...

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

Ned
May 23, 2002

by Hand Knit
According to the function reference it needs to be sanitized.

code:
$metakey = "Harriet's Adages";
$metavalue = "WordPress' database interface is like Sunday Morning: Easy.";

$wpdb->query( $wpdb->prepare( "
	INSERT INTO $wpdb->postmeta
	( post_id, meta_key, meta_value )
	VALUES ( %d, %s, %s )", 
        10, $metakey, $metavalue ) );
I looked at your code and you do have a prepare in there so I guess things should be fine. Just check a couple of the ones where you insert everything from $p.

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?

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.
I've done something bad to my blog, but I can't work out how to fix it.

It's here: *

I can't get at the dashboard. If I try to log in, either through the link onscreen, or directly using the correct path, it just gives me the blog screen again.

The only 2 things I did, as far as I can remember, were to auto update, and when I was trying that, I got a fast CGI error. After the blog started behaving like it is now, I thought maybe it had only part-updated, so I cleared out the right files, and manually installed the newest version, and updated the database.

The other thing was to change the URL of the blog in the dashboard - from * to the above URL. I then changed back immediately after thinking about it and realising that was a bit stupid. When you navigate back to the main part of the website using the 'main' link in the navbar, despite it having a direct link, it remains within the blog subdirectory. I was trying to fix this. Buuut, if I'd already pointed the link somewhere else, I'm thinking it couldn't have actually made the change back as it was pointing at a part of my server that contained none of the wordpress files.

Sorry for that long winded description, I need some help figuring out what files I now need to alter to regain access

RobertKerans fucked around with this message at 00:05 on Nov 29, 2009

Ned
May 23, 2002

by Hand Knit
Do you have access to your db? You need to go into the options table and update the location of your Wordpress install to http://www.blog.daneilcouper.com/. There should be two settings in the options table that deal with the url of where your blog is. If you change them you should be set.

However, https://www.blog is a very lame subdomain.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.
Merci beaucoup

& yeah, the subdomain is a bit lame, I'm just trying to get everything working first. Easy for who I want to find it to find it though, so I'm loth to change it. Sketchbook it could possibly be

such a nice boy
Mar 22, 2002

I'd like to make a debate-style blog, and I'm wondering if I should try to massage wordpress into doing what I want or just custom-coding something from scratch.

The idea is that a poster can challenge another poster to a debate. If it's accepted, those two posters will alternate posts on a single page. They'll be the only ones allowed to make the main posts; however, other people will be able to comment. I'd like for the comments to appear in a sidebar, showing up next to the post that they're referencing.

In the future, I might add a scoring system (where commenters can give +1 or -1 to posters and explain what the points are for).

Would Wordpress be good for this? Any advice on possible ways to implement it?

To simplify things, at first, only two posters (specified by me) will have debating rights, so the "challenge someone to a debate" part doesn't really need to be in the first iteration.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
I've gotten myself stumped. He;lp?

I want to have a category description displayed - chosen randomly from all available categories - that links to the category page using the description as the link text.

I can make it work if I specify the category, but I'm not sure how to get it to iterate through my categories to be random.

Here's what I have so far:
php:
 <?php 
$category_id get_cat_ID'Finance' );
$category_link get_category_link$category_id ); 
?>

<a href="<?php echo $category_link?>">
<?php echo category_description($category_id ); ?>
</a>
I'm so close, but not sure how to randomly put one of my category names into get_cat_id . Any ideas?

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

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
I kind of cheated and just threw some category names into an array for now:

php:
<?
$input = array("Finance", "Utilities", "Games", "Media", "Internet");
$rand_keys = array_rand($input, 2);

$category_id =  get_cat_ID ($input[$rand_keys[0]]);
$category_link = get_category_link( $category_id ); 
?>

<a href="<?php echo $category_link?>">
<?php echo category_description($category_id ); ?>
</a>
?>
I'll look at get_categories later and see if I can get it to fill that array for me. Thanks NSS.

Adbot
ADBOT LOVES YOU

mynameischainsaw
Aug 12, 2008
I'm having trouble with galleries in wordpress. I add a gallery in using wordpress' 'insert gallery' button, and then I go into the HTML editor and add size="thumbnail" to the [gallery] code. It ends up looking like this:

[gallery link="file" column="3" size="thumbnail"]

my thumbnails are set to 150x150. in the wordpress gallery the pictures are only 150 for the width, and they are the height of the full size picture. what am i doing wrong? is there a better way to go about this?

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