Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi Aakash,

    That sounds great! Even though the interface is a bit confusing, I think your plugin is really good. It does exactly what I want it to do. I tried several social plugins and settled on yours.

    I look forward to seeing the next version.

    Cheers,
    –Will

    1. Go to the WP Socializer settings page.
    2. Click on the Placement tab (along left side of settings).
    3. Click on the “Template 2” tab (along the top – NOTE: by default you will be looking at “Template 1” tab).
    4. Clear out the code you see which will look something like this:
      <h2>Share & Enjoy</h2>
      {social-bts-16px}
    5. Click the blue “Update” button.

    This puzzled me forever. It really is a bewildering interface…but it seems like a really good plugin otherwise. The guy that wrote is lightyears more intelligent than me!

    I hope this helps.

    Hi alchymyth,

    In fact I did have a twitter plugin called “WP Twitter Button”, which I deactivated as both the like and twitter plugins I replaced with wp socializer. So, that may have been the culprit.

    Thanks for the input.

    Turns out it was a plugin called simply “Like” that was setting my og:description tag to look like this:

    <meta property="og:description" content="Tweet Tweet" />

    All this plugin did was put a Facebook like button on my page. I deactivated that plugin and have replaced it with one called “wp socializer.”

    I am now using a plugin called “Open Graph Protocol In Posts and Pages” to customize how my pages share on Facebook. It’s a good plugin except apparently — after I set it up — I will need to click “update” on each page and post to get it to start putting the correct Facebook sharing info in my pages.

    I am researching this now…Wordpress is setting my site’s og:description to “tweet tweet”…even after I installed plugins to customize my sites og metadata.

    Okay, ACTUALLY, I randomly discovered an even better solution, which is to either set up the heading like so…

    <h2><a name="some-heading">Some Heading</a></h2>

    OR (and this is EVEN BETTER)…

    <h2 id="some-heading">Some Heading</h2>

    Either way, we can link to these bookmarks like so…

    <a href="www.somepage.com#some-heading">Some Heading</a>

    Neither of these heading setups makes WordPress add the unwanted paragraph tags to begin with!!!

    Cheers.

    Actually I discovered I do not need to worry about matching the heading element itself. Also, my previous solution was not catching all cases. Below is slightly better code (it can be improved!)…which also may not catch all possible cases, but seems (so far) to catch the ones I need it to…

    // Whenever I surround a heading tag with a name anchor
    // WP adds unwanted P and BR tags, this function strips them out
    add_filter('the_content', 'remove_bad_pbr_tags');
    function remove_bad_pbr_tags($content) {
    
            // CORRECT OPENING ANCHOR TAG...
    
            // find any opening name anchor tags preceded by a <p> and followed by a <br /> and
            // replace them with just the name anchor itself
    	$content = preg_replace('/<p><a name=[\"\'](.*)[\"\']><br\s*\/>\s*/', '<a name="$1">', $content);
    
            // CORRECT CLOSING ANCHOR TAG...
    
            // the closing anchor tag is followed by 2 or more new-lines in the WP editor...
            $content = preg_replace('/\s*<p><\/a><\/p>/', '</a>', $content);
    
            // the closing anchor tag is followed by a single new-line in the WP editor...
            $content = preg_replace('/\s*<p><\/a><br\s*\/>/', "</a>\n<p>", $content); // the double quotes are necessary in the second parameter for the \n to be considered a newline
    
            // the closing anchor tag is immediately followed by content (i.e., no new-lines) in the WP editor...
            $content = preg_replace('/\s*<p><\/a>[^<]/', "</a>\n<p>", $content); // the double quotes are necessary in the second parameter for the \n to be considered a newline
    	return $content;
    }

    This ended up being the code I used…

    // REMOVE BAD P and BR TAGS FROM NAME ANCHORS
    add_filter('the_content', 'remove_bad_pbr_tags');
    function remove_bad_pbr_tags($content) {
            $pattern = '/<p><a name=[\"\'](.*)[\"\']><br\s*\/>\s*<h([1-9])>(.*)<\/h([1-9])>\s*<p><\/a><br\s*\/>/';
            $replacement = "<a name=\"$1\"><h$2>$3</h$4></a>\n<p>";
    	$content = preg_replace($pattern, $replacement, $content);
    	return $content;
    }

    I’m not too good at REGEX…so I’m sure that could be more elegant than it is…but it did match exactly what I wanted it to and replaced it with exactly with what I wanted.

    I just appended it to the end of the functions.php file in the twentyten theme.

    I have a similar problem…

    If I put a name anchor around a heading, WP adds P and BR tags to the whole mess for some reason.

    For example, if I write the following:

    <a name="some-name"><h2>Some Heading</h2></a>

    WordPress (when using the TwentyTen theme, at least) outputs the following HTML:

    <p><a name="some-name"><br/>
    <h2>Some Heading</h2>
    <p></a><br/>

    This results in horrible gaps around my headings.

    Anyways, I think this thread may offer me a band-aid for this problem. Thanks.

    If I enter the following:

    <a name="css-style-blocks"></a>
    <h2>CSS Style Blocks</h2>

    WordPress outputs…

    <p><a name="css-style-blocks"></a></p>
    <h2>CSS Style Blocks</h2>

    …which doesn’t have the gap issue, but I’d rather have the anchor surrounding my heading.

    Maybe this will provide a workaround for this issue. Thanks.

    I have a similar problem.

    If I type in my sitename into the address bar with the www in front (www.mywebsite.com), it’s fine. If I type it into the address bar without the www (mywebsite.com), I see a blank page, but the view-source shows the xml is fine…odd.

    Now that I know the xml IS there, it’s no big deal, but at first I thought it wasn’t getting the xml at all.

    (by the way, awesome plug-in!!!!)

    i find this question interesting.

    I’m thinking one should use the wordpress function get_category_parents(). it returns a string that is a list of category parents of the current category. the list appears to start with the top-most category and end with the bottom-most (the immediate parent of the current category)…though I could have it backwards.

    You can choose how to have it separated…a comma would probably be good. leave nicenames set to false (don’t set it to true as it defaults to false), that way i guess you get category id numbers. then you can split the string on the separator and voila, you’ve got all the cat IDs from top to bottom (you can get the nice names later via the ID).

    Alternately, you could turn nicenames on make sure you use a separator symbol that will NOT be in any of your category names so that the split only splits on the separators and not in the middle of any cat’s name.

Viewing 11 replies - 1 through 11 (of 11 total)