Jump to content

Search the Community

Showing results for tags 'posts'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 4 results

  1. Hi All, I'm currently trying to find a solution to a problem within a wordpress template I am using. On the homepage, Im using a widget to display recent posts. However, the widget displays all posts, whereas I want it to only display posts from a particular category. What do I need to edit within the php to make this happen? Heres the widget php: <?php /** * List Blog Posts * * @since Jobify 1.0 */ class Jobify_Widget_Blog_Posts extends Jobify_Widget { /** * Constructor */ public function __construct() { $this->widget_cssclass = 'jobify_widget_blog_posts'; $this->widget_description = __( 'Jobify - Display recent blog posts.', 'jobify' ); $this->widget_id = 'jobify_widget_blog_posts'; $this->widget_name = __( 'Jobify - Home: Blog Posts', 'jobify' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Recent News Article', 'jobify' ), 'label' => __( 'Title:', 'jobify' ) ), 'description' => array( 'type' => 'textarea', 'rows' => 4, 'std' => '', 'label' => __( 'Description:', 'jobify' ), ) ); parent::__construct(); } /** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { if ( $this->get_cached_widget( $args ) ) return; ob_start(); extract( $args ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $description = $instance[ 'description' ]; $posts = new WP_Query( apply_filters( 'widget_jobify_blog_posts', array( 'posts_per_page' => 3, 'ignore_sticky_posts' => true ) ) ); echo $before_widget; ?> <div class="container"> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <?php if ( $description ) : ?> <p class="homepage-widget-description"><?php echo $description; ?></p> <?php endif; ?> <div class="content-grid row"> <?php if ( $posts->have_posts() ) : ?> <?php while ( $posts->have_posts() ) : $posts->the_post(); ?> <?php get_template_part( 'content', 'grid' ); ?> <?php endwhile; ?> <?php endif; ?> </div> </div> <?php echo $after_widget; $content = apply_filters( 'jobify_widget_blog_posts', ob_get_clean(), $instance, $args ); echo $content; $this->cache_widget( $args, $content ); } }
  2. Im running a website about health and foods. I would like that at the end of each article, it shows other related articles that I have on my website. Im relatively new with php and mysql so I figure I have to put every page onto a database table. I looked already everywhere but all I found is how to do with wordpress. But i'm not using anything like that. I made the website myself with css and html and php. Can somebody help me with a website where they explain how to do? Also I would like that automatically it shows my latest articles in a sidebar. Without anytime adding myself manually. Can anybody help me?
  3. I just recently replied to this post http://forums.phpfreaks.com/topic/287248-scrape-html-then-create-db-using-regex-to-snag-keywords/ but the date is showing Posted Yesterday, 11:19 PM This post was done at 7:32 PM EST and shows Posted Today, 12:32 AM
  4. I am learning so please excuse my lame questions! Here is what I have so far: Categories, of course and news in there. On the home page I have a box for every category with one main post, a picture and several more posts with titles only. I can make a view for every category with my basic skills but I need to do it the right way (or somehow the right way). It seems to me like some very complicated foreach statement but nothing has come to mind yet. Give me some starting point please. I would be very grateful for any directions, ideas or examples. Thank you! Featured post:http://oi59.tinypic.com/2i7sgwl.jpg Progress: I made it happen somehow Categories boxes:http://oi58.tinypic.com/epopiw.jpg Progress: Here is what I have for now: class Post extends Model { public $rows_posts; public $rows_featured_posts; public $_id; public function get_posts() { $this->_db->query("SELECT * from posts"); $this->rows_posts = $this->_db->resultset(); } public function get_ceatured_posts() { $this->_db->query("SELECT * from posts WHERE featured = 1 LIMIT 1"); $this->rows_featured_posts = $this->_db->resultset(); } } Child Class: class Featured_Publication extends Post { public $rows_featured_posts; public function create_featured_post() { $this->get_ceatured_posts(); foreach ($this->rows_featured_posts as $row_featured_post) { include_once VIEWS_PATH . 'homepage/featured_publication.php'; } } } I can do this for Featured posts, but I don't know how to show the contents from all categories in different boxes. I can only show the category title on the top of each box, but cannot put the posts in there. I suppose this below is wrong because it is not working at all. A class Category: class Category extends Model { public $_rows; public $_id; public function build_category() { $this->_db->query("SELECT * from categories"); $this->_rows = $this->_db->resultset(); } public function category_items() { $this->_db->query("SELECT * from posts WHERE category_id = '{$this->_id}'"); $this->_rows = $this->_db->resultset(); } } Child Class: class Category_Boxes extends Category { public $_rows; public $rows_posts_in_category; public $category_id; public function get_posts_from_category() { $this->build_category(); $this->_db->query("SELECT * from posts WHERE category_id = '{$this->category_id['category_id']}'"); $this->rows_posts_in_category = $this->_db->resultset(); } public function build_category_box() { $this->build_category(); $this->get_posts_from_category(); foreach ($this->_rows as $row) { include VIEWS_PATH . 'homepage/category_box.php'; // Here is my view for the category box } } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.