Danh mục

Wordpress 3.0 jQuery - part 16

Số trang: 10      Loại file: pdf      Dung lượng: 2.14 MB      Lượt xem: 12      Lượt tải: 0    
tailieu_vip

Hỗ trợ phí lưu trữ khi tải xuống: 4,000 VND Tải xuống file đầy đủ (10 trang) 0

Báo xấu

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu wordpress 3.0 jquery - part 16, công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Wordpress 3.0 jQuery - part 16Doing a Lot More with Less: Making Use of Plugins for Both jQuery and WordPressLast, for this new page to be recognized as a special template for WordPress, wehave to add a template header to the very top of the document in commented outPHP as shown here: ... As with our plugin in Chapter 3, Digging Deeper: Understanding WordPress and jQuery Together, make sure there are no spaces or hard returns before the Chapter 4Thats the first half of our solution. Lets now finish it.Creating the custom category templateWe now need to create a special category template for the Events category. Again,well want each event to have a registration link. That link will pass the events titleto the registration form. [ 137 ]Doing a Lot More with Less: Making Use of Plugins for Both jQuery and WordPressTo get started with this, if youll recall the Template Hierarchy from Chapter 3,Digging Deeper: Understanding WordPress and jQuery Together, the category.phptemplate page trumps the archive.php template page. Turns out, the defaulttemplate that were using doesnt have a category.php page. Well simply createone by duplicating the archive.php page and naming it category.php.But wait; we dont just want this page to show any category. We want to only showthe Events category. Youll also recall from Chapter 3, Digging Deeper: UnderstandingWordPress and jQuery Together, that you can further trump the category.phptemplate with a specific category-ID.php template page such as category-3.php.It just so happens that in my local setup of WordPress, the ID for the Event categoryis 3, so thats what well name the file. Finding your category ID Those of you working in your own WordPress installation, the category ID numbers are assigned as you create categories. First, youll need to determine what your Events categorys ID number is. You can do this by navigating to the Posts | Categories page in the Administration panel and selecting Edit under the Events category. You can then check the URL in that categorys Edit page. At the very end of the URL youll see the categorys ID number.Were now ready to customize the category-3.php template for the Events page. [ 138 ] Chapter 4First up, as we saw in the previous chapter, this page calls the get_template_part(loop, category ) function from the loop.php template page. We actuallywant a custom, very simple setup for the Events category only. While we certainlycould update the if...else statement of loop.php with an additional customloop (which is a tad beyond the scope of this book, stay tuned for the upcomingWordPress 3.0 Theme Design book from Packt!), for this custom client project welljust comment out the call to that loop and add in our own very simple loop that,thanks to the Template Hierarchy, will only work on our Events category page. Doing a Lot More with Less: Making Use of Plugins for Both jQuery and WordPressNotice that in the loop towards the bottom, we made a link tag that references theregister form. Ive ammended a variable string named evnt to that link and addedthe title of the event using the get_title() template tag as shown: ... Chapter 4 .register-separate{ clear:both; padding-top: 10px; border-bottom:1px solid #999; }When we look at an event post now, well see our Event post with a dynamic link atthe bottom to Register:Getting jQuery in on the game planAlright! I dont know about you, but I feel that was quite a bit of prep-work. Its allgoing to come together now as we load up the ColorBox plugin and cook up a fewfinal custom jQuery scripts. [ 141 ]Doing a Lot More with Less: Making Use of Plugins for Both jQuery and WordPressIncluding the ColorBox pluginIn our theme, lets create a js directory, and within that directory, lets create anadditional directory named colorbox. This will allow us to place in the CSS sheetand image collateral for the ColorBox plugin and keep everything tidy and workingthe way it prefers to work in the colorbox.css sheet.Well unzip our ColorBox plugin and move over the minified version into ourjs/colorbox directory. Well then take the stylesheets and collateral from theexample1 folder (I like it the b ...

Tài liệu được xem nhiều: