Forums

[resolved] Multisite Blog_ID (23 posts)

  1. Jerry Craig
    Member
    Posted 1 year ago #

    I've got a couple questions.

    1) I've got a multisite install and am using custom product post_types in subdirectory blogs. As each Product is posted I would like to create a Product ID number that is unique that includes the "Blog Id number - post id" which should then be unique across the multisite install.

    2) I would like to also use the same categories and tags across the entire multisite install. I'm using CMS Press to create my custom post_type. Do I just reset the blog to original before the CMS Press hook somehow or maybe a custom query and custom plugin? I'm going to use a sphinx search server and I'm hoping for a large number of individual product listings. The size should be small though of each record. The Categories are going to match Google's Product Taxonomy and the tags are going to be used for my Meta Keywords so I will actually need both although that's probably not considered best practices.

    Thanks,

    Cupbearer

  2. 1) So you want to know how to extract the blogID?

    It's under blog_ID

    global $blog_id;
    echo $blog_id;

    should do it.

    2) No idea, but someone else may know of a plugin for it.

  3. Jerry Craig
    Member
    Posted 1 year ago #

    umm... wow, i read around all that stuff yesterday for something else, can't believe I didn't see that. So #1 is done. It ended up looking like this:

    <?php global $blog_id;
           $meta_values = get_post_meta($post->ID, 'msrp', true);
           echo "Product#: " . $blog_id . "-" . $post->ID . "    MSRP: $ " . $meta_values;
    ?>

    to see it would be at foodnav.com/lilsassysalsa page :)

    Now just for the global Categories and Tags. There are 83 Categories before I start adding my own more specific ones and I have just barely started adding tags but expect to have way way more than that. I would really like to just click select each of them in the sidebar of my custom post_type entry page.

    Thanks for the help so far.

    [Removed sig - They're against forum rules]

  4. http://wordpress.org/extend/plugins/wpmu-new-blog-defaults/ can be used to set up the categories for all new sites.

    As for the rest, the best I can think of is Sitewide tags, which gathers up all the new posts across the network and puts them on the main blog. see instructions:
    http://wpmututorials.com/plugins/using-the-sitewide-tags-plugin/

  5. Jerry Craig
    Member
    Posted 1 year ago #

    I took number 2 issue to VOCE Communications since they are the ones that did the CMS Press plugin that I'm using and whatever I do with the widgets in the sidebar is going to be a part of their plugin and code.

    However, if I can't get something from them to help out, I'll be back to build a custom widget to try to stick into their plugin in the dropdown screen options section. Just an FYI.

    [Sig Deleted]

  6. Yeah, the problem with it is that MultiSite is a network of related but disconnected sites. Think WordPress.com or Blogger :) Your site has no 'data' in common with the others on the network.

    Also please don't use signatures on the forums, they're not allowed.

  7. Andrea_r
    team pirate
    Posted 1 year ago #

    If you're creating custom posts types and need them across the network - don't use a plguin. hand code them and put the code in mu-plugins.

    that won't set up global categories though.

  8. Jerry Craig
    Member
    Posted 1 year ago #

    sorry, fixed my gravatar also :) Had the wrong email addy in profile.

    That indeed is the issue for me. The site is going to be a Free Directory of smaller food companies. I want to explicitly control the data so that it's uniform and easily searchable, but leave all of the aspects of design and layout open to the individual companies to make it match their own sites if they want to take the time to do so and maybe change some aspects of the data, like descriptions and such. I'm sure it's coming in a future release of WordPress as it is becoming more and more a CMS and less blogger only tool, but that's not now. When I started working on this in my spare time at version 2.8 mu everything is completely different now.

    Thanks

  9. Jerry Craig
    Member
    Posted 1 year ago #

    I had thought to put it all in the child theme "functions" file for the custom post_types, but since I plan on letting others into the theme to possibly change some of the css display stuff and things like that I thought it better to keep them outside in the plugins portion, just in case so others couldn't mess it up. Are you saying then that I could write the plugin myself and load it up into the mu-plugins folder and have that across all of the blogs with all of the specifics. The CMS Press is pretty quick as all of the fields are saved by the browser and it's just a quick dropdown to pick the custom field that I'm lookin for and then enter the data.

    I have some reading and studying into the plugin and widget aspects as I'm still quite the noob. I'm about 3/4 of the way through the lynda.com plugins and widgets tutorial so I recognize what's going on if not specifically how to change it.

    Thanks,

  10. Jerry Craig
    Member
    Posted 1 year ago #

    so, if I have more questions on what I was working on yesterday should I just add them to this discussion or start a new one?

    thanks,

  11. Jerry Craig
    Member
    Posted 1 year ago #

    ok, so i was working on this yesterday.

    <title><?php echo bloginfo('name')." | " . get_post_meta(102, 'zip', true) . " | Foodnav.org" ;?></title>

    It gives me the result I wanted on the blog that I was on. I'm going to put the custom field on the "About" page, but that page will be located in different post_id's and I've put this in the header.php file. I'm guessing that I need to declare a variable and then get post_id from the permalink somehow since that will always be the same? So how do I return the post->ID for a specified permalink. Some sort of bloginfo url and add the "about" at the end and then try to get the ID from that?

    Thanks,

  12. What are you trying to accomplish with that code?

  13. Jerry Craig
    Member
    Posted 1 year ago #

    The <title> tag in the header I want to have the individual companies name that contains just their Products then a zip code and then the name of my site. So it looks like this on the test product's that I've entered:

    Lil' Sassy Salsa | 85246 | Foodnav.org

    I want the zip code so that I can start to localize the searches in the future to locally made products only if that is what someone is looking for. Zip codes seems the easiest standard data size/format to use. In the single post title tag I want to add the name of the Product which is the Title of my custom post_type so that it would look like this:

    Lil' Sassy Salsa | Chipotle Salsa | 85246 | Foodnav.org

    It's just a way to standardize the data. I figured out that since I want to store the custom field in the "About" section for each company as a standard place to store it, that I could then pull that data back into any of the pages I wanted in the Title tag.

    Thanks,

  14. And you're using the same theme for every site, and not every site has the same post-id for the about page?

    Uuuuugh. I have to think about this...

  15. Jerry Craig
    Member
    Posted 1 year ago #

    That will be the fall back to make the "about" page the very first page in every new install, but, eventually that will cause a problem.

    The themes may actually change and use my theme as the parent theme so that they can change up the colors and stuff to match their actual web sites so that the directory listing matches up to their existing color schemes and logo's and stuff.

    thanks,

  16. If layout stays the same and only colors change, you can use the Safe CSS plugin to let each site change at will.

    it's the extraction of the zip that has me caught. Is this a per-post zipcode, or a per-site?

  17. Jerry Craig
    Member
    Posted 1 year ago #

    sorry, so long in between replies, I'm supposed to be on vacation hanging out at the beach with the family :) We each have to have our hobbies i guess.

    It's going to be both. used in the header for each post/page, the only difference is that for a single post page I want to add that 1 extra bit of info which should be pretty easy I would guess. It's a matter of narrowing the ID for that code down to being able to take a permalink like http://foodnav.org/lilsassysalsa/about and convert that into an ID. The 102 is the ID of the about page on that site as I've been messing around with adding a bunch of stuff and finally got around to the zip code thing after I had all the other post stuff figured out.

    And should I just run the heck out of this thread, as you might imagine this is the beginning of a very long acquaintance since there doesn't seem to be many that I can ask these questions of. Separating them to some degree might be better as others can then search them better and use them for reference?

    Thanks,

  18. Separation of questions would be best ;)

    I'm about to head out till Sunday, anyway. Maybe someone else has an idea, but my brain stopped after biking in the rain.

  19. Jerry Craig
    Member
    Posted 1 year ago #

    cool, fun travel day tomorrow and too much vodka tonight to be discernable. I'll be home Sunday myself with a real desktop and some room to work and think. Although I think I'll be hitting up my sphinx server for a few days. I really appreciate the ideas. I'm really lacking someone to bounce this stuff off of :)

    and if i still played, dorf clerics rule :) I and II

  20. Jerry Craig
    Member
    Posted 1 year ago #

    I've decided that I'm going to use the add_option() to get the zip code to be available on every page. I'll have to figure out how to use that but was thinking that I could add that to the options table when I was on the plane today at 35,000 feet with no way to check what I was thinking.

    For #2 above I think I might of figured out how to get started with that one as well. With the new 3.1.x WordPress they put a lot of the "screen options" at the top of the page. I should be able to add my own check box/widget in there that will have it's own db query to blog 0 for categories and tags. I'll keep you posted on the progress of that one as I've seen tons of requests for something like that and no clear answers on how to get global categories and tags. This will hopefully work with my custom post_type.

    Thanks,

  21. I should be able to add my own check box/widget in there that will have it's own db query to blog 0 for categories and tags.

    THAT can be done. I've not the faintest idea how, but I know plugins can do it.

  22. Jerry Craig
    Member
    Posted 1 year ago #

    Ok, I'm back and have been working on the Zip Code to be able to put in the Title tag area as well as eventually GeoCode the posts. But, I'm stuck again. I've decided that I could just use a plugin and put this in mu-plugins folder and then add it once in the General Settings for each sub-blog. Then I can just pull from blog_info when I want the info back. The field is showing up in html, but when I add the zip code it's not saving to the database and it's not even creating the field in the options table? I'm thinking that I should have update_option() in there somewhere, but I thought the whole settings thing was supposed to take care of adding and updating the fields?

    <?php
    	function optzipgeo_init()
    	{
    		register_setting('optzipgeo_options', 'optzipgeo');
    	}
    
    	add_action ('admin_init', 'optzipgeo_init');
    
    	function optzipgeo_field() {
    		?>
            <input type="text" name="optzipgeo" id="optzipgeo"
            		value="<?php echo get_option('optzipgeo'); ?>" />
            <?php
    		};
    
    	function optzipgeo_plugin_menu ()
    		{
    			add_settings_field('optzipgeo', 'Options Zip Code for Geotag', 'optzipgeo_field', 'general');
    		}
    
    	add_action('admin_menu','optzipgeo_plugin_menu');
    ?>

    Thanks,

  23. Jerry Craig
    Member
    Posted 1 year ago #

    you can close this one. It was in the register_setting line. It should read:

    register_setting('general', 'optzipgeo');

    Since I was trying to add the optional field into the General Settings tab, it needs to be "whitelisted" in register settings in 'general'. All of the tutorials don't really talk about whitelisting something.

    I'm going to work on the other part in another thread.

Topic Closed

This topic has been closed to new replies.

About this Topic