How would one marking up Wordpress content with RDFa? - wordpress

Hopefully, I can write this to avoid any problems that caused a similar post to be closed. I don't mean to invite debate or say whether or not RDFa should be handled on Wordpress in a way similar to another CMS. I just want to see if one were going to do this, how it would be done. In other words, do we do this in the theme? Ideally, we need custom fields and RDF mappings for each field and for the Content type.
So, maybe this goes in the Wordpress functions.php file. The user interface would need a way to ask the user, what property to assign to each field, e.g. if it is a name, then we might use foaf:name. The content type itself, would correspond to a RDF type, aka Class. I'm not sure how one would accomplish this.
Thanks,
Bruce

I think that i'd implement RDF using Simple Fields: http://simple-fields.com/ to add custom fields specifically to post types.
Then i'd print the data with the correct XML syntax in the theme.
Maybe you can write some helpers in your functions.php (or similar) to avoid code duplication to print RDF information, but this is something more.

Related

Does 2sxc have tags and categories?

I've yet to find that 2sxc has facilities for entering, browsing, filtering and otherwise allowing keyword based filtering/sorting. If so, is there documentation about this, or sample code perhaps?
I'd think it might also be likely that one could use DNN's pretty good capabilities for tags and categories, and also razor queries would enable this, but I'd sure love to see some examples/guidance on best practices for doing so from within 2sxc.
This is very easy to do, but it's much more advanced that just tags / categories.
Basically you
Create a new ContentType for the related information - like Tag, Category or whatever. It can have more fields than just a title, as a category could also have an icon
Add some of that data
Go to the content type where you want to use it, create a "Entity / Content-Item" field
Then go to the field settings, give it the name of the related info that is allawed and if 1 or more items may be added (category is often just 1, Tags is often many)
that's it :)
I think I've found a start on this at:
http://2sxc.org/en/Docs-Manuals/Feature/feature/2685
and the demo at
http://2sxc.org/dnn-app-demos/en/Apps/FAQ-with-Categories

Where should I be storing extra strings for Wordpress site

I have a wordpress site with a theme. But now I need to extend it.
For example, I want to make a custom section on the homepage. The section needs a header which is not a part of any post. I know how to code this, but I don't see where I should be storing the string which will be displayed.
Possible solutions:
Store in the PHP file itself, obviously not a good idea.
Store in the database as an option, using
get_option( 'my_custom_header', 'default_value' );
The issue with this is that there is no easy way to edit the value other than opening up the database directly.
Use an options plug in. The ones I have seen seem an overkill.
Write my own so I have a table specifically for such tables.
So the question is what is the best place to be storing such strings?
Greg
What I ended up doing was extending the existing theme options panel to add a few extra options.

Drupal - Show content on specific page

Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog

Drupal 7 - Administration - Find node by it's field value

I'm looking for the way for the site's administrator / moderator to find / filter the list of nodes by some field custom value. Field value could be defined by radio / text / checkbox etc.
Default content listing proposes only few filters, it's not enough for sites with huge amount of custom nodes.
Use an EntityFieldQuery object, documented here:
http://api.drupal.org/api/drupal/includes--entity.inc/class/EntityFieldQuery/7
The documentation has no examples (ugh), but there's a thread here with some:
http://drupal.org/node/916776
EDIT: Ah, you're talking about administration and not actually writing a module to do it. If that's the case, use a view with exposed filters, like the other guy said. :)
Maybe it would help to use a view for it, where you set filters, so that you get the desired listing.
I had to test this, but I've just confirmed. Views in Drupal 7 can indeed filter across multiple content types w/ custom fields, and still have filters apply to those custom fields. They seem to treat the nodes w/o those custom fields as empty or null values.
So for instance, I have article and blog content types. Blog has images, article does not. I can sort or filter on the image field, even though article doesn't have it. It simply assumes the field is null or empty.
This however, may not solve your problem of having a large number of custom fields. If these are dynamic (i.e. they grow over time) you might be in trouble. If, however, they are set, and just a very large number, you could manage this.
So while there is no automatic add all fields, which I believe you mentioned in a previous post, you could feasibly search on a large variety of the fields. Even exposing fields that you don't necessarily display in the table, but can then search on. Or changing the fields you expose or display on a per page basis in the view. All from one view. And then you could export the view to bring it over to the other sites.
I was going to try and attach the exported view, but the export is rather large for inclusion in an answer, I think. Please let me know if you think I should still include it, or if you'd rather I can simply send it to you through a PM. Let me know!
EDIT: I decided to include a link to an export of the view. http://greggalante.com/sites/greggalante.com/files/cross_type_view.txt
http://drupal.org/project/search_api

How can I categorize the content types on the Drupal "Create content" page (/node/add)

How can I categorize/organize the content types on my "Create content" page? I'm running Drupal 6.x with CCK. I have a lot of custom content types, and my "Create content" page has become a bit unwieldy, as it lists them all alphabetically. I'd like to organize them by category, so users would see something like:
Create Content
Reports
Report Type A
Report Type B
Events
Event Type A
Event Type B
I don't want to mess with Core, but anything else (custom module, theming, existing module functionality) is fair game. I'm hoping I'm missing something easy, because this seems like an obvious requirement, but all I could find on the Drupal site were these unanswered questions:
Organize Create Content Page
(node/add)
Core: Split create
content page into categories?
You should be able to accomplish this in a custom module, without hacking core.
You'll want to implement hook_menu_alter() to take over the callback function for node/add.
Something like
function mymodule_menu_alter(&$items) {
$items['node/add']['page callback'] = 'mymodule_node_add_page';
}
should get you started. You would then create the function mymodule_node_add_page, and you could use the original callback function as a starting point.
You can also do this at the theme level by overriding theme_node_add_list().
There are some different ways to attack this problem. You can overwrite the old form page or just create a new one with a custom module. Doing that you can in your module do whatever your want.
Another possibility is to do the same thing using views instead. Doing that gives you access to a lot of powerfull features, as you can do anything the views module lets you do. You can create different ways of sorting the content types.
I've heard of many who have used views to make a page like this for the create content page. Which method you choose is up to you, depending on how exactly you want to do this and the data you have associated with your content types, one will be more easy than the other. But without knowing the exact details, I can't say which. I would advise you to start out with views, since you quickly should be able to find out, if you can use it to get what you want.
there's a module that does what you are looking for, Content type groups
I created a sandbox module some time ago which was supposed to do this:
https://drupal.org/sandbox/YaronTal/1260038
The only problem is that I wasn't able to create the admin backend with draggable interface at the time.
I know the issue is old, but just in case someone else has the same problem...

Resources