Looking to display blog entries instead of project listings

I have a theme that supports displaying Portfolio Items on a full-width portfolio Home page. However, these portfolio items do not support videos but I can embed videos in normal posts. What I need to do is change the homepage to display category posts instead. Below is the code:

<?php 

                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                    $showposts = $data['home_recent_number']; 

                    $args = array(
                                    'showposts' => $showposts ,
                                    'post_type' => 'portfolioentry'
                                  );

                    $my_query = new WP_Query($args);
                    $wp_query = $my_query;

                    query_posts("showposts=$showposts&post_type=portfolioentry&paged=$paged");

                    $limit_text = 100;
                    $currentindex = '';
                    $counter = 0;
                    $count = 0;
                    $temp = '';
                    while ( have_posts() ) : the_post();
                        $do_not_duplicate = $post->ID; 
                        $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false);
                        $entrycategory = get_the_term_list( $post->ID, 'portfoliocategory', '', '_', '' );
                        $catstring = $entrycategory;
                        $catstring = strip_tags($catstring);
                        $catstring = str_replace('_', ', ', $catstring);
                        $categoryname = $catstring;                         
                        $entrycategory = strip_tags($entrycategory);
                        $entrycategory = str_replace(' ', '-', $entrycategory);
                        $entrycategory = str_replace('_', ' ', $entrycategory);

                        $catidlist = explode(" ", $entrycategory);
                        for($i = 0; $i < sizeof($catidlist); ++$i){
                            $catidlist[$i].=$currentindex;
                        }
                        $catlist = implode(" ", $catidlist);


                        $category = get_the_term_list( $post->ID, 'portfoliocategory', '', ', ', '' );  

                        if(isset($full_image[0]))
                            $img = get_template_directory_uri() .'/js/timthumb.php?src='.$full_image[0] .'&';
                        else
                            $img = get_template_directory_uri() .'/js/timthumb.php?src='.get_template_directory_uri() .'/images/placeholder-port.png&';

                        ?>
                            <div class="item4">



                        <a href="<?php the_permalink(); ?>">
                            <div class="overdefult">

                                <div class="viewIcon"><?php echo getPostViews(get_the_ID()); ?></div>
                                <div class="likeIcon"><?php echo GetWtiLikeCount($post->ID) ?></div>

                            </div>
                        </a>
                        <div class = "detailsoverdefault">
                            <h3><a href="<?php //the_permalink(); ?>"><?php $title = substr(the_title('','',FALSE),0,30); echo $title  ?></a></h3>
                            <a href="<?php //the_permalink(); ?>"><div class = "moreButton">+</div></a>
                        </div>
                        <div class="image">

                            <img class="newimage <?php echo $newheight ?>" src="<?php echo  $img ?>" alt="<?php the_title(); ?>">
                        </div>  

                        </div>  
                    <?php 




                    endwhile; 
                    ?>

    </div>


</div>


Thank you in advance. You can view a demo of the theme at

Answer №1

Give this a go

content_type=post

run_query("displayposts=$showposts&content_type=post&paged=$paged");

Answer №2

Revise

$parameters = array(
    'showposts' => $display_count ,
    'post_type' => 'article', //find articles
    'paged' => $page_number,
);

Omit the query_posts (it negatively impacts loading times)

Substitute the line within the while loop with:

while ( $custom_query->have_posts() ) : $custom_query->the_post();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to eliminate the additional square bracket from a JSON file containing multiple arrays?

Seeking JSON data from an array, I encountered an issue with an extra square bracket appearing in the output. After attempting $episode[0] = $podcast->getPodcastByCategoryId($id);, only partial data was retrieved, corresponding to the first iteration. ...

Retrieve all events from Cumulocity based on device ID and specific date and time

Hey everyone, I've been working on integrating the Cumulocity API with PHP and everything seems to be set up correctly. However, I'm facing an issue when trying to fetch event/events by deviceId. $url = 'https://*********.iot.a1.digital/even ...

Page expired error 419 encountered after successful login - Laravel - Running on Windows Server 2012 R2

After creating a project in Laravel 5.8.32 and testing it on my local environment with PHP 7.2.28, everything worked fine. However, when I tried hosting the project on a Windows server with PHP 7.2.7, I encountered a 419 | page expired error after logging ...

In my database, I have two tables: Table1 and Table2. To better illustrate my issue, I have included a picture for reference

https://i.stack.imgur.com/GQAMy.jpg I am facing a challenge with joining two tables, table1 and table2, in MySQL. I need assistance in creating the resultant table as shown in the attached picture. Your help in solving this issue would be greatly appreci ...

Ensure that the central section of the slider remains illuminated

Looking for help with customizing my "product" slider, lightSlider. I want the middle div to always be highlighted when navigating through the slider. Here's what it looks like currently: Link to screenshot - current. My goal is to achieve this look: ...

Having trouble running a form due to the inclusion of JavaScript within PHP code

My PHP code includes a form that connects to a database, but when I add JavaScript to the same file, the form does not execute properly. (I have omitted the insert code here.) echo '<form action="$_SERVER["REQUEST_URI"];" method="POST">'; ...

The menu item is having trouble aligning to the right side

Hello, I am currently working on developing a website menu for a project and I am facing an issue with aligning the "Login" Menu item to the right side. Any assistance in resolving this alignment issue would be greatly appreciated. I am also willing to pro ...

Adding HTML and scripts to a page using PHP and JS

Currently, I am utilizing an ajax call to append a MVC partial view containing style sheets and script files to my php page. Unfortunately, it seems that the <script> tags are not being appended. After checking my HTTP request on the network, I can ...

tips for effectively organizing and arranging data in a mysql table

I could use some guidance on mastering more advanced mysql/php commands, moving beyond basic query statements and array looping. In my database, I have a table storing publications authored by different faculty members. Each publication is linked to a spe ...

Implementing Laravel's ajax pagination to dynamically set the current page

Within my Laravel project, I utilize hashes in the URL to track user selections, allowing them to easily revisit filter results without refreshing the page. I specifically avoid updating the URL with 'Page=someid' (aside from the hash). The serve ...

A guide on deleting a specific value from a JSON array in PHP

Here is a code snippet that I am working with: $json_encode = '{"OS":"Android","Title":"Galaxy"}'; $json_decode = json_decode($json_encode); foreach($json_decode as $key => $value) { if($key == 'Title') { unset($key); ...

How can I take a screenshot from the client side and save it on the server side using PHP?

Currently, I am exploring the possibility of screen capturing at the client side. It appears that the "imagegrabscreen()" function can only capture screens on the server side. After some research, I discovered a new function that allows for screen capture ...

Retrieve the final segment of web addresses

I'm currently pulling data from a page using the following code snippet: <?php $speaker = $page->uri(); $speakerEvents = page('program')->grandchildren()->filter(function($child) use($speaker) { $speakers = $child->speak ...

Controllers in Laravel are not detecting the public function

Recently, I obtained a Laravel/Vue.js project from Bitbucket for the company I am currently collaborating with. Setting it up on my computer seemed like a routine task since I have worked on similar projects in the past. However, this time around, I encoun ...

PHP script to automatically redirect users to a specific page after logging in

Having trouble redirecting from the login page after validating the username and password. Can someone please review my code and provide guidance on how to fix this issue? <?php include('session.php'); ?> <?php include("conf ...

Can I use Javascript to make changes to data stored in my SQL database?

I am delving into the realm of SQL and Javascript, aiming to insert my variable ("Val_Points from javascript") into a table ("Usuarios") associated with a specific user (e.g., Robert). Is it possible to achieve this using JavaScript, or are there alternati ...

Converting Array into a String

I am currently facing an issue with a simple case statement used to check the value of $item, which is returned as an array. Despite the array being equal to "iphones", the code always returns the default case statement. Is there a straightforward way for ...

I require access to information stored in a log file, utilizing commands such as tail, grep, and inotify

I have a situation where data is being continuously added to a log file on one server. I need to extract specific information from this log file using the grep command, and then transfer that information to another server for insertion into a database usin ...

Guide on how to confirm the successful sending of an email or track errors using Codeigniter AJAX

Is there a way to return a value back to AJAX from the controller once the email has been sent? Here is some code: In the following code, I would like to store flash data in the session and have it set under specific conditions to be called back in AJAX. ...

Is there an HTML editing tool that has the ability to collapse code blocks by tags and rearrange them?

I'm in search of a text editor or IDE that includes syntax highlighting and allows me to collapse HTML code blocks by tag. I currently use Eclipse, but its "folding" feature only works on top level tags like TABLE, not child tags like TD and TR. Are t ...