Forum Replies Created

Viewing 15 replies - 271 through 285 (of 309 total)
  • I looked at your site, it looks like all the posts are flagged as in the tweets category. You might want to run your pages through the XHTML validator, I saw a mismatched </p>.

    But you said

    if I just paste it into index.php and modify the category slugs it only duplicates the titles of posts.

    The operative code is just this:

    if (is_category(array('tweets','Tweets'))) {
               echo ' class="tweet"';

    Which adds an extra class to the tag you are wrapping around the post title, so you can style it differently.

    If you can post some of your code (especially the Loop), it will help us help you.

    For an FLV (Flash video) or MOV (Quicktime video), try the WordTube plugin, it comes with a sidebar widget.

    https://www.ads-software.com/extend/plugins/wordtube/

    Forget about Flash, SWF, “flash movie” etc… unless you’re creating a custom video player. Adobe uses the term “movie” for flash runtime applications and that may confuse… “movie” != “video”. You want video.

    Good question. Easy solution.

    Try this in your templates (using the correct category slugs):

    <h3<?php if (is_category(array(3,'twit','Tweet'))) {
               echo ' class="tweet"';
         } ?>><$php the_title(); ?></h3>

    and then of course add a style for h3.tweet

    Docs: https://codex.www.ads-software.com/Conditional_Tags

    Actually I believe it is just $post->ID, if you dig into the docs you’ll discover that the post table is used to store posts, pages, and attachments.

    And you can also use the template tag the_ID() instead.

    See the docs: https://codex.www.ads-software.com/Template_Tags

    You might also find these conditional tags helpful:
    https://codex.www.ads-software.com/Conditional_Tags

    Forum: Plugins
    In reply to: Plugin to Widget issue

    That’s probably the one – not having seen the code.

    Try the statement:

    global $AI_Interface;

    before the method call. I assume there’s a global declaration inside the plugin, but if not, add one there.

    (P.S. – Don’t forget an if_function_exists(some_plugin_function) and/or if ($AI_Interface) call before, so you don’t get errors when/if the plugin is deactivated.)

    I think I understand… you actually type the shortcode or insert it via the editor in some way, so it is stored in the database as part of the post?

    What I suggested above will work in that case, although you’ll need to make the shortcode disappear on output.

    But if I might suggest an alternative?

    Instead of adding a shortcode, which is usually used for replacing content via a filter, why not either directly add a new editor selection to the Write Post / Write Page forms, which sets a custom field, or (try this first) open the Custom Field dialog, and add something with key CSS and value style2.css.

    Then in your head action, simply check for a custom field that matches the key and use the value to include the desired style sheet.

    For some additional information: custom field by default

    That way you don’t need to mess with the content at all, and you can even make a dropdown listing only the valid css files to choose from (with descriptive choices rather than filenames, too).

    (Note that you can also use the custom Page Template selector, and check this in your head action, if you need different output logic to go with the special stylesheet, and in that case you won’t need a custom field)

    If the function is never called, the filter is never activated. Keep it outside – for what you’re attempting. You usually want WP to set up your filters and actions when it reads in all the PHP, before it has started doing any real output.

    Only write one filter (for the head). If you’re only “analyzing” the content you don’t need to filter it. In the head function, you can access anything you need in WordPress, so you can analyze the content from there… and then make changes to the head. Make sense?

    OK, here’s an example of something similar… except it is an action not a filter, but same concept.

    function my_header_recipe() {
    	global $post;
    	# only if the Page has a parent slugged "recipes"
    	if (($parent = $post->post_parent) &&
    	    (the_slug($parent) == 'recipes')) {
    		// DO SOMETHING HERE
    	}
    }
    add_action('wp_head', 'my_header_recipe', 1);

    Of course if you got all that but were trying to do something really strange like look at the content AFTER it had been filtered, you might have a problem with timing…

    I noticed you weren’t retrieving the meta with the posts… so here’s an option to modify what I just posted.

    Use the SELECT to only return one unique row

    replace

    SELECT wposts.*

    with

    SELECT DISTINCT wposts.*

    Your SQL logic is contradictory/impossible.

    Your tables have a one to many relationship… for a post with ID = foo, you’ll have three separate items in the postmeta table.

    ie,

    posts                | postmeta
    id      title        | id    meta_key   meta_value
    ----+----------------+----+-----------+-------------
    17       'foobar'      17    'model'    'bar'
    17       'foobar'      17    'city'     'smallville'
    17       'foobar'      17    'state'    'FL'

    so you can’t possibly have a meta_key = ‘model’ AND = ‘city’ (in the same record)

    Here’s a rudimentary solution that will result in 3 records (with the same id and posts data but different meta data) for each unique id, it’s a start … and a tip – test the SQL out on your DB first manually, it’s easier to debug. (I shortened up the SQL using p for posts and m for the meta table)

    SELECT wposts.*
    FROM $wpdb->posts p, $wpdb->postmeta m
    WHERE p.ID = m.post_id
    AND (
      (m.meta_key = 'model' AND m.meta_value = '".$model."')
      OR
      (m.meta_key = 'city' AND m.meta_value = '".$city."')
      OR
      (m.meta_key = 'state' AND m.meta_value = '".$state."')
    )
    AND p.post_status = 'publish' AND p.post_type = 'post'
    ORDER BY p.post_date DESC

    This is the simple answer, but depending on how many $model matches you have, and what you’re doing with the results, determines your choice of how to improve it. Google for one to many SQL queries and you’ll see a lot of opinions.

    Just write a flash app to display your RSS feed (or a custom XML/RSS feed). I’m not aware of any existing flash apps or plugins, but that looks fairly simple. PS Don’t forget graceful degradation, so the spiders and js/flash phobics will still see your post list.

    Gee this gives me some ideas for the spare 5 seconds a week I have ?? actually, it really makes sense for real estate so maybe I’ll build something…

    Roger

    Forum: Plugins
    In reply to: Custom fields to Pages?

    Try this thread: custom field by default

    You can add the code to your theme.

    With the AdServe plugin? https://www.ads-software.com/extend/plugins/adserve/

    There are only 13 results if you search the plugin directory for “advertising”, so if that’s not what you wanted… take a peek at the other plugins.

    (I’m sure the OP must have found it after 8 months…)

    Try WordTube, it comes with a sidebar widget.

    @daltonrooney – old but good… all these sites are inspiring.

    Forum: Plugins
    In reply to: WP_Rewrite SUCKS

    Try this thread, rewrite is still pretty scary but for the original poster’s problem I think this might work:


    https://www.ads-software.com/support/topic/174334

Viewing 15 replies - 271 through 285 (of 309 total)