Search Amazon.com:
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 $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
«7 »
  • Post
  • Reply
Ned
May 23, 2002


Jadus posted:

Quick question for those experienced with Wordpress; my site currently displays full posts when you first hit it.

I'd like to change this to Post Previews with the first 200 characters, but in doing so it strips any images nearby those first 200 characters, leaving the post pretty flat looking.

Is there any way to make sure the post preview doesn't exclude images? Google-fu is failing me on this one.

I'm using Mystique theme in case this is theme specific.

Does the theme support post thumbnails? If you use those with the_excerpt() to display the beginning of the post you can make things look nice.

Adbot
ADBOT LOVES YOU

Ned
May 23, 2002


Any reason why it takes 3 people to program it?

Ned
May 23, 2002


The guy who makes Thesis is a douche and not well liked by the folks in the WordPress community. There are lots of frameworks to choose from, I say choose a free one.

Ned
May 23, 2002


micropenis posted:

Did not know that! What makes him such a douche? Googling "thesis wordpress douche" didn't yield very good results...

He's basically a guy who ripped off WP code and sold a non-GPL theme and claimed to be one of the 3 most important people in the world of WordPress. He's very full of himself and thinks his theme is amazing.

Ned
May 23, 2002


My suggestion these days is AWS.

Ned
May 23, 2002


Gasmask posted:

So I'm using a GET query to check the URL for a certain component. If this component is present, the page loads a different header and pulls a different stylesheet. This allows me to completely change the layout of a page, based on which (if any) of these 'theme' elements is provided.

Now, this works fine given a manually created URL - I can just add ?theme=whatever at the end - but I'm wondering if there's a way for me to force WP to add this extension to any internal links that are present on the page?

Basically if a user arrives via a certain theme URL I want them to stay within that theme for their entire session. Is this at all possible for WP generated internal links?

WordPress doesn't use sessions but you could probably set a cookie and then check if it exists and apply a filter to the_permalink. The other possibility is to use the cookie to add a class to the body and then use jQuery to check if that class exists on the body and then have it modify any links by adding your value to the end of them.

Ned
May 23, 2002


BuddytheRat posted:

I am having custom taxonomy issues.
When using the get_the_terms_list() function I get an error which I eventually found out was due to an 'invalid taxonomy'.
I've no idea why!

Those custom taxonomies aren't being registered properly. You need to register the taxonomy in general, not for a specific page id.

Ned
May 23, 2002


If you want to do something for a specific page it is best to set up custom meta for that page. It is a lot more work though.

I'll try to explain the concept of taxonomies - I'm not 100% certain but I believe WordPress started out with Categories and then plugins were created to set up tags. Tags were implemented into the WordPress core and eventually the database was modified to make tags and categories use the same table.

register_taxonomy tells WordPress what new taxonomies exist. If you define it in a function that checks the post id then it won't know that taxonomy exists except on the page that matches the post id - you'll never see this in the admin unless you are trying to edit that specific id.

If you really want to use the current method you have but hide it for everything but the specific page you want it to appear on, you should probably create a css file that hides the boxes on the pages you don't want the boxes to appear on.

But you should really create custom post types with the appropriate meta boxes for board members.

If you make a board member custom post type and then a taxonomy to describe what type of member they are then things will actually be much simpler. You'll be able to describe the members properly within their own post type and set up a template file that you can associate with a page to display all of them properly. Then you keep your posts as regular posts and can customize board members all you want without changing the basic functionality of posts.

It is not really a lot of work to set up custom meta for post types. If you'd like I can post some examples tomorrow. I've been doing a lot with custom post types and custom taxonomies recently.

But a basic custom post type can be super simple.
code:
register_post_type( 'board_members',
		array(
			'labels' => array(
				'name' => __( 'Board Members' ),
				'singular_name' => __( 'Board Members' )
			),
		'public' => true,
		'has_archive' => true,
		)
	);
Then all you have to do is use your existing code and switch 'page' with 'board_members' and create a template file that uses get_posts to find posts with the custom post type of board_members and the matching taxonomy.

edit: really love the word really. Should expand my vocabulary.

Ned fucked around with this message at May 31, 2011 around 15:32

Ned
May 23, 2002


Is TinyMCE really that hard to use? If someone can't log in and edit content then no matter what system you use you are always going to be fighting your stupid users and the system at the same time.

Just get the folks to log in, then make sure each page has an edit post link on it.

Ned
May 23, 2002


muscat_gummy posted:

Yep! We're pretty much talking needing a CMS to be usable by your 100-year-old grandma who thinks computers run on witchcraft. If I can get some of them to even log in that will be a triumph. Guess I'll just have to fight it in that regard. Hopefully I will triumphantly return to this thread at some point in the future in order to link to the awesome plugin I will develop to make the dashboard idiot-proof.

You'll never win this battle. If people want their applications to be as stupid as they are then you'll never make a good application. If someone can't learn to use simple applications properly then you need to put someone who knows what they are doing between them and their website.

Ned
May 23, 2002


Did you rebuild the permalinks after you created the custom taxonomy? Even if you register it you need to tell WordPress what to look for. When you set it back to the default permalinks it looked through the custom post types to create the set of expressions it looks through when trying to determine what DB query to run based on the url string.

Ned
May 23, 2002


muscat_gummy posted:

Potential Wordpress WTF: I went to edit a Wordpress plugin only to find out that the author wrote a function to decode its option. Why the gently caress would he just not have used update_option() and get_option()? Now instead of a pretty array there's "a:4:{i:0;a:5" type of stuff to deal with.
Am I missing something here where doing that would make sense? It just seems like an unnecessary extra step.

That should just be a serialized object once it is pulled out with get_option. What plugin is it that you are using?

Ned
May 23, 2002


It might have been really old. WordPress doesn't do a good job of culling old plugins from their repository and a lot of people end up installing something that was a hack from way back in the day.

Ned
May 23, 2002


Your paths are all wrong. How are you including your css and js?

Ned
May 23, 2002


run this somewhere


update_option('siteurl', 'http://wolveswhere.com/' );
update_option('home', 'http://wolveswhere.com/' );

Ned
May 23, 2002


Put it in the functions.php of the theme and run it once. You can remove it once the options have been updated.

Your issue right now is the root of the site is / but the wordpress install is in /wordpress and things like your css and js aren't getting called properly because they don't know they are being called from outside of /wordpress

Ned
May 23, 2002


Actually, this one needs to be


update_option('home', 'http://wolveswhere.com/wordpress' );

If it is in functions.php of the current theme it will get run whenever a page is loaded.

Ned
May 23, 2002


Problems solved.

Ned fucked around with this message at Jun 21, 2011 around 06:36

Ned
May 23, 2002


thegasman2000 posted:

Has anyone played with widgets much?

I need a menu in my sidebar which is just some links to certain pages. The issue is that I want the menu to expand on hover. I can seem to get it to work with traditional coding.

You'll need to control that with js and css. You can tell the widget to enqueue the javascript and css so it only loads when the widget is active.

Ned
May 23, 2002


Broccoli Must Die! posted:

Are there any WordPress plugins yet that will post a "New Blog Post On...." type entry on Google+, similar to that of WordBooker for Facebook?

I've found a few for a +1 style button on individual entries, but not for an automatic solution at the time of publishing.

Give it a little bit of time. It's not like Google announced what they were doing with +.

Ned
May 23, 2002


That's actually going to be quite complex because anything that is stored as post meta is only text and it hard to compare dates if they are text.

Ned
May 23, 2002


McGlockenshire posted:

strtotime can parse pretty much anything and then you can throw a '+1 day' at it in order to get the day after.

Once you pull the posts out everything is going to be fine because then you are dealing with PHP and not SQL. The important thing is going to be making sure you are saving your dates in a way where they can be compared as text instead of dates when you are putting them into the custom fields.

Ned
May 23, 2002


Use firebug. It will make you understand CSS. Also, go check out the Web Design/Development megathread. If you read your way through that you'll learn an incredible amount.

Ned
May 23, 2002


Bastard posted:

Thanks, but those are workarounds, just like using a regexp. I just want WP to give me an multidimensional array of pages, not a completely pre-formatted list. Why is the WP codebase so crappy every now and then/most of the time?

Write your own function to do it? You can use the wp_get_archives code as your base and just have it return an object with the results and then format those.

wp_list_pages could easily be replace by a regular get_posts query.

These two functions have been around forever and were basically ways to put archives/pages in a sidebar. They are both template tags - the archives has been around since 1.2 and list_pages has been around since 1.5.

Asking for a multidimensional array of pages is actually a bunch of queries if you have lots of child/parent relationships. For each individual page you'll have to get any children for that page and continue until the children run out of children. You could definitely write something to do it. I recommend storing any output as a transient in order not to have to constantly run all those queries and just have it update when a new page is created.

Try this: http://codex.wordpress.org/Function..._page_hierarchy

If you want to add classes to specific links you'll have to parse the object and build your own html.

Ned
May 23, 2002


Bastard posted:

That's my point. For example, wp_get_archives returns a preformatted string, and there's no easy way to format that in any other way.

And of course you can create your own functions, that isn't the problem. It's just that a lot of WP built-in functions seem to completely poo poo on the concept of separating data and views.

Maybe it's just me, but the more I work with the WP code itself instead of just installing plugins/themes, the less developer-friendly it seems.

A lot of the template tags are about displaying things in standard ways. Regular functions are about getting back data. You can tell wp_get_archives to use a custom format and then tell it what goes before and after each link. Are you looking to add a class to a specific link in the archives or do you want to add a class to all of them?

I believe WP is very developer friendly. Maybe it is because I am somewhat of an evangelist but when I look at the docs and then take a look at a link to the code in the repository I understand how it works and what options I have when dealing with the functions and then have the ability to make an appropriate decision about how I want to go about handling things.

It doesn't hurt to put a tiny bit of jQuery after a template tag if you want to parse the data and add a class to a part of it. It doesn't hurt to run the output through simple HTML DOM and modify it on that level either.

Ned
May 23, 2002


Just borrow the query you want from the wp_get_archives code and go to town.
code:
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts 
FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
$key = md5($query);
$cache = wp_cache_get( 'wp_get_archives' , 'general');
if ( !isset( $cache[ $key ] ) ) {
	$arcresults = $wpdb->get_results($query);
	$cache[ $key ] = $arcresults;
	wp_cache_set( 'wp_get_archives', $cache, 'general' );
	} 
else {
	$arcresults = $cache[ $key ];
}
if ( $arcresults ) {
	foreach ( (array) $arcresults as $arcresult ) {
            //do stuff with $arcresult
        }
}
If you take out the caching it's even shorter. I'm not going to apologize for the wp_get_archives function because it is really old and is just meant to display a list of archive links. It could be a lot better. But compared to other CMS platforms WordPress is very dev friendly.

Ned
May 23, 2002


Gyshall posted:

Standard website, with minimal CMS type of stuff. Maybe a blog, but that would be easy enough to hack through later.

It is a corporate restaurant supply chain, for what that is worth. They sell basically any type of food/meat/ingredient to major restaurants. The main feature of their (early 2000s page) is a "Products" page which lets you see the different order #s and products they have.

You should try to make a custom post type for products and put all of the info in there. It will pay off in the long run.

Ned
May 23, 2002


rugbert posted:

How can I use the is_single function with an array variable?

I know I can do this
code:
<li<?php if(is_single(array("originals", "prints", "t-shirts", "books"))) echo " class=\"expand\""; ?>>
But thats not very dynamic, if I have an array that Im adding stuff to Id like to be able to use that with is_single. Is that possible?

Do it like this.
code:
$single_check = array('originals', 'prints', 't-shirts', 'books');
$expand = false;
foreach ($single_check as $single) {
   if (is_single($single)) {
      $expand = true;
   }
}
if ($expand == true) {
   echo '<li class="expand">';
}
else {
   echo '<li>';
}

Ned
May 23, 2002


Mike1o1 posted:

I've been working on a simple child theme and I'm trying to make some of my posts a little bit cleaner by not displaying comments when the user views a single post, unless the user specifically went to the_comments url. I'm not really sure how to do this, though.

I know I can use comments.php to modify how the comments are displayed, but I'm not sure what I need to do on single.php. Do I need to use some conditional code to analyze the incoming URL and if "?comments" is in the URL, then display and format the comments?

There is a global called $paged that will tell you what page of comments is being requested. Check that in your single.php and modify the output accordingly.

Ned
May 23, 2002


You need to do
code:
global $paged;
echo $paged;
It doesn't actually exist in the URL string but it does exist in the WP Query object.

Ned
May 23, 2002


Kitsch! posted:

I do need to read up more on Firebug. I was working on link hover features recently and while the Firebug screen was showing one thing (that I wanted to remove), my original CSS was not showing it at all.

I feel like a technology-ignorant elderly person

It might have been put in there with javascript.

Ned
May 23, 2002


Use the css to negative text indent it. Or you can make the text really small and have it be the same color as the background.

Ned
May 23, 2002


Bonefish posted:

I would love for someone to tell me how they got jQuery UI installed and functional on their wordpress theme. I am tearing my hair out trying to get this to work, but no love.

code:
wp_enqueue_script('jquery-ui-core', '', array('jquery'));
wp_enqueue_style('jquery-ui-theme', get_bloginfo('stylesheet_directory') .'/jquery_ui_stylesheet.css');
That will load the code and you'll need to install a jQuery UI theme in your theme directory and link to the stylesheet.

Ned
May 23, 2002


Ignis posted:

Have you tried out qTranslate? The plugin's site is also a demo of the plugin, in case you want to check it out.

This is the correct answer! I use this quite a bit.

Ned
May 23, 2002


fuf posted:

I guess in the long run something like qTranslate would be better than my current solution, which requires putting css directly into each post (not ideal).

Why does it require you to do this? You should be able to stick the language into body_class() and modify the layout with the regular css files.

Ned
May 23, 2002


fuf posted:

Are you talking about qTranslate? I don't know what body_class() is.

I was talking about my own clunky solution where I put the French and English in the same post but in two separate divs and then use jQuery to switch between which is visible.

When making a theme in WordPress you should start out your body tag by writing this:
code:
<body <?php body_class(); ?>>
This shoves a bunch of classes onto your body that make it easy to modify the design with css based on the page rendered.

qTranslate does put both or all languages into the same field in the database but it encapsulates them and pulls out the appropriate one based on what language the reader has selected.

WPML actually modifies the database and links various posts/pages to one another. I think qTranslate is the better plugin as it tries to do things the proper WordPress way.

Ned
May 23, 2002


stormrider posted:

The export is going to be a bitch though, as the review engine stores product information, review summary, review text, and review data in separate tables. Anyone love php and sql and want some paid work? Posting this here before looking elsewhere, as even though the work isn't directly WP related, the end result is.

I can probably do this for you if the content is on the web. I have nice methods for scraping data and shoving it into WordPress.

Ned
May 23, 2002


Just do echo "Whatever" if you don't really care about it being available in other languages. Otherwise you can modify the language files in the theme.

Ned
May 23, 2002


Just rename the theme. If you really need to update it you can do it manually by replacing files in the future.

Adbot
ADBOT LOVES YOU

Ned
May 23, 2002


check out the query it is making and see what happens when you run it against the database directly.

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