Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

Robert on "Valid JSON outside of WordPress returns NULL in WordPress"

$
0
0

I have been working on a trivia game plugin for our website. I first built the trivia outside of WordPress to get the basics down and working before complicating things with WP. I got the thing finished and then started working on converting it to a plugin. For some reason, using json_decode with the .json file does not work in WordPress.

I know that the JSON file is valid because it works fine outside of WP and I've run it through several validators out on the web.

This is what I'm using in the plugin:

$json_data = plugins_url('data/questions.json', __FILE__ );
$parsed_data = json_decode($json_data,true);

Inside of the WP pluging, sending through var_dump results in NULL. Sending it through json_last_error() gives: JSON Error: - Syntax error, malformed JSON

Strangely, taking the exact content of the file and using:

$parsed_data = json_decode('pasted json code in here');

works fine, it only seems to think there is a problem with the JSON when it is in a separate file. Is there something about plugins_url() that could be messing with it? I'm out of ideas as to what is causing this problem.

Thanks!

Note: I've tried some of the suggestions out on the web for using preg_replace() with no luck, also - the file reports that it is ASCII and not UTF-8.


shaunny on "Unable to filter single post query"

$
0
0

I have a client with a theme that adds extra post types; artists and artworks.
One of the meta values for artworks is the artist, and it links the two post types together, as opposed to using a taxonomy instead.

I've created a plugin that filters artworks on the admin pages by the artist in question, however, when it is filtered, it also filters all post queries, including the one that populates my dropdown box.

Because the Artists post type does not have the same meta key, all query results are null, and I'm unsure how to get it to distinguish between the two.

The full code can be found below:

<?php
/**
 * Plugin Name: Artwork Filter by Artist
 * Author: Shaun Cockerill
 * Verion: 0.1
 * License: GPL2
**/

function restrict_artworks_by_artist() {
    global $typenow;
    global $wp_query;
    if ($typenow=='artworks') {
        wp_dropdown_users();
    }
}
add_action('restrict_manage_posts','restrict_artworks_by_artist');

function wp_dropdown_artists_modified( $args = '' ) {
	$re = '<select name="artist" id="artist"><option value="0">Show All Artists</option>';
	$posts_array = get_posts( array( 'post_type' => array( 'artists' ), 'posts_per_page' => -1 ) );
	foreach ( $posts_array as $post ) {
		if ( isset( $_GET['artist'] ) && ( $post->{'ID'} == $_GET['artist'] ) ) {
			$re .= '<option value="' . $post->{'ID'} . '" selected="selected">' . $post->{'post_title'} . '</option>';
		}
		else {
			$re .= '<option value="' . $post->{'ID'} . '">' . $post->{'post_title'} . '</option>';
		}
	}
	$re .= '</select>';
	return $re;
}
add_filter('wp_dropdown_users', 'wp_dropdown_artists_modified');

function ba_admin_posts_filter( $query )
{
    global $pagenow;
    global $typenow;
    if ($typenow=='artworks' && !empty($_GET['artist']) && is_admin() && $pagenow=='edit.php' && is_main_query()) {
	$query->query_vars['meta_key'] = 'artist';
	$query->query_vars['meta_value'] = $_GET['artist'];
    }
}
add_filter( 'parse_query', 'ba_admin_posts_filter' );

I have tried adding && $query->query['post_type'][0]=='artworks' to my if statement within ba_admin_posts_filter, however it no longer filters any queries.

dhruven on "My Sit is hacked. please help me."

$
0
0

hi
my website is
http://webhostingreviewandcoupon.com
in my wordpress deshboard i am post only 41 post but in google index it was 600 post and other post are porn site post which is harm my original website so please give me some solution about this issue.

hydrurga on "Unwanted character entities in utf8"

$
0
0

Hi there,

I've noticed that single quotes (') entered in the text editor get converted to in the final HTML output by Wordpress, despite wp-config.php containing the line define('DB_CHARSET', 'utf8');.

Does anybody know if I can easily find a way, preferably without hacking the core code, to have, for example in this case, single quotes in text to be converted to a relevant UTF8 character () instead?

Many thanks indeed.

alphamartin66 on "High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /"

$
0
0

High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /
High Profile Daman /ℰScoℛT? ! 0⑨8⑦6846⑦8⑨ ! Daman /

alphamartin66 on "High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh"

$
0
0

High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh
High Profile Chandigarh/ℰScoℛT? 0⑨8⑦6846⑦8⑨! Chandigarh

tomalpha32 on "ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice"

$
0
0

ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice
ℐndependent SuRat ℰScoℛTs 09871931389SuRat ℰScoℛTs SeRvice

dannybeton on "wp_trim_words formatting"

$
0
0

I'm using the wp_trim_words function to just take the snippet of a custom post's content:

echo '<p>' . wp_trim_words( get_the_content(), 50 ) . '</p>';

The content text is formatted as follows:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale!

This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

But when wp_trim_words() is used it's displayed as:

"One of our VIP members (well… Ned) has his 1984 black Porsche 924 for sale! This car is in truly terrific order and is well known locally having been frequently shown at numerous classic car events. To see the advert on DoneDeal click here."

The break return after "for sale!" is gone.. Is there any way to keep the formatting of the post when using wp_trim_words() ?


jone3fingers on "geocoding & not writing to DB empty lines"

$
0
0

I wrote this form to make a front-end form fill in the table for the store locator plus plug-in.
I need to take the sl_address and sl_city fields and have them geocode for sl_longitude and sl_latitude.

also, the first time someone goes to the page it submits an empty line in my database table.

I am newbie, so sorry if this very simple.

<?php
/* Template Name: Add Venue */
get_header();
?>

<div id="primary">
<div id="content" role="main">

<form id="form1" name="form1" method="post" action="">
<input type="hidden" name="sl_id" id="sl_id" />
<br class="clear" />
<label for="sl_store">Venue</label><input type="text" name="sl_store" id="sl_store" />
<br class="clear" />
<label for="sl_address">Address</label><input type="text" name="sl_address" id="sl_address" />
<br class="clear" />
<input type="hidden" name="sl_address2" id="sl_address2" />
<br class="clear" />
<label for="sl_city">City, State, Zip</label><input type="text" name="sl_city" id="sl_city" />
<br class="clear" />
<input type="hidden" name="sl_state" id="sl_state" />
<br class="clear" />
<input type="hidden" name="sl_zip" id="sl_zip" />
<br class="clear" />
<label for="sl_country">Country</label><input type="text" name="sl_country" id="sl_country" />
<br class="clear" />
<input type="hidden" name="sl_latitude" id="sl_latitude" />
<br class="clear" />
<input type="hidden" name="sl_longitude" id="sl_longitude" />
<br class="clear" />
<input type="hidden" name="sl_tags" id="sl_tags" />
<br class="clear" />
<label for="sl_description">Description</label><textarea name="sl_description" id="sl_description" cols="45" rows="5"></textarea>
<br class="clear" />
<label for="sl_email">Email</label><input type="text" name="sl_email" id="sl_email" />
<br class="clear" />
<label for="sl_url">Website</label><input type="text" name="sl_url" id="sl_url" />
<br class="clear" />
<label for="sl_hours">Hours</label><textarea name="sl_hours" id="sl_hours" cols="45" rows="5"></textarea>
<br class="clear" />
<label for="sl_phone">Phone</label><input type="text" name="sl_phone" id="sl_phone" />
<br class="clear" />
<label for="sl_fax">Fax</label><input type="text" name="sl_fax" id="sl_fax" />
<br class="clear" />
<label for="sl_image">Image</label><input type="file" name="sl_image" id="sl_image" />
<br class="clear" />
<input type="hidden" name="sl_private" id="sl_private" />
<br class="clear" />
<input type="hidden" name="sl_neat_title" id="sl_neat_title" />
<br class="clear" />
<input type="hidden" name="sl_linked_postid" id="sl_linked_postid" />
<br class="clear" />
<input type="hidden" name="sl_pages_url" id="sl_pages_url" />
<br class="clear" />
<input type="hidden" name="sl_pages_on" id="sl_pages_on" />
<br class="clear" />
<input type="hidden" name="sl_option_value" id="sl_option_value" />
<br class="clear" />
<input type="hidden" name="sl_lastupdated" id="sl_lastupdated" />
<br class="clear" />
<input type="submit" name="sl_submit" id="sl_submit" value="Submit" />
<br class="clear" />
</form>

<?php //Post Params
$sl_id = $_POST['sl_id'];
$sl_store = $_POST['sl_store'];
$sl_address = $_POST['sl_address'];
$sl_address2 = $_POST['sl_address2'];
$sl_city = $_POST['sl_city'];
$sl_state = $_POST['sl_state'];
$sl_zip = $_POST['sl_zip'];
$sl_country = $_POST['sl_country'];
$sl_latitude = $_POST['sl_latitude'];
$sl_longitude = $_POST['sl_longitude'];
$sl_tags = $_POST['sl_tags'];
$sl_description = $_POST['sl_description'];
$sl_email = $_POST['sl_email'];
$sl_url = $_POST['sl_url'];
$sl_hours = $_POST['sl_hours'];
$sl_phone = $_POST['sl_phone'];
$sl_fax = $_POST['sl_fax'];
$sl_image = $_POST['sl_image'];
$sl_private = $_POST['sl_private'];
$sl_neat_title = $_POST['sl_neat_title'];
$sl_linked_postid = $_POST['sl_linked_postid'];
$sl_pages_url = $_POST['sl_pages_url'];
$sl_pages_on = $_POST['sl_pages_on'];
$sl_option_value = $_POST['sl_option_value'];
$sl_lastupdated = $_POST['sl_lastupdated'];

?>
<?php //Query

//INSERT
$query = " INSERT INTO bqk_store_locator ( sl_id, sl_store, sl_address, sl_city, sl_country, sl_description, sl_email, sl_url, sl_hours, sl_phone, sl_fax, sl_image ) VALUES ( '$sl_id', '$sl_store', '$sl_address', '$sl_city', '$sl_country', '$sl_description', '$sl_email', '$sl_url', '$sl_hours', '$sl_phone', '$sl_fax', '$sl_image' ) ";
$result = mysql_query($query);

if( $result )
{
echo 'Success';
}
else
{
echo 'Query Failed';
}

?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>

VFBA on "Calling JS and ASP files through page post"

$
0
0

Hi Guys,
I have been working with a Wordpress site and with my past basics in HTML have had a lot of fun tweeking the site to make it look the way we want.I'm hoping you guys could help me with a tweek that i cannot seem to figure out.

I am trying to add a cost calculator as a form in one of my pages within the wordpress site. here's problem:

I have a html form that calls an external .js file named seller-calc.js. i pasted the code into a 'new page' post and called the js file from within the post using:

<SCRIPT language=javascript src="http://69.195.124.135/~fivestk2/calcfiles/seller-calc.js"
type=text/javascript></SCRIPT>
<!--updatepage();
//--></script>

this method worked great and i was able to get the scripting behind the form to work now that it was calling the js file. heres a link to this page:

(http://69.195.124.135/~fivestk2/cash-closing-cost-estimator/)

my problem is the the form post action:

<form id="someform" action="http://69.195.124.135/~fivestk2/calcfiles/closingcosts.asp" method="post" name="someform">

the inputs of the form get sent to another file named closingcosts.asp:

<input id="save" style="color:#000" type="button" onclick="(someform.submit());" language="javascript" value=" Next " name="save"/>

I cannot get the second part of this calculator to work, when i click the "next" button inside the form it goes to the .asp page, but i see it as code?!

im trying to get the form to work as intended, where you plug some info into the form, click next, and it sends this info to the second part that summarizes all the figures and lets you input an email to forward the information to. I have all the files and coding for this form to work, just getting lost trying to make it work inside wordpress page. Any advise would be greatly appreciated, i think i've had about a gallon of coffee trying to sort it out. Thanks Guys.

officewife on "wp-config.php edits"

$
0
0

Not sure if this is the right place to ask, but when including this:
define( 'DISALLOW_FILE_EDIT', true );
in the wp-config, where do I place it? The documentation does not say where it goes in the file.

Thank you.

mysteryentry on "Uploading images + Video externally to Wordpress admin"

$
0
0

Hi all, I am hoping someone can point me in the right direction. I have paid a programmer in the past to develop a site however I am now looking to try to develop as much more on my own as possible.

Can someone point me in the direction of some information I could use to implement Image upload/video embed onto this page http://www.joketwist.com/submit.

You get the idea from the page it creates posts externally to wp-admin.

Thanks
Oliver

qdungeng on "get post from slect field ACF"

$
0
0

Dear friend

I did install ACF (advanced Custom fields) and Create Select Field "Hotel_in", and more choices :
SG : Saigon
HN : Hanoi
HC : Hue City

...

Please help me how to get all post title and URL from single field and get label from single choices .

I did use :

if(get_field('hotel_in') == "HG")
{
//...
}

But it not working. Please help me.
Thanks

proxio on "Add popup/lightbox on woocommerce "add to cart" action"

$
0
0

Hi all,

I would like to know how to add a popup/lightbox on "add to cart" click.

I would like to show the popup/lightbox with :

- image of the product added
- message "XXX has been added to your cart"
- and text & image with "You may also like..."

Do you know how to do this, or is there a plugin? That would be awesome!

projectfuturism on "Saving Base64 String as a Media Attachment"

$
0
0

Hi all. I'm absolutely stumped and can't seem to find a solution to this.

Basically, I'm sending a POST request from outside of my wordpress installation '/wp-admin/admin-ajax.php' to send an image to Wordpress and save it as an attachment to one of my posts.

To do this I have converted the image to a Base64 string on the client side using Javascript, sending that as part of the POST request, decoding that on the server side as part of my script, moving the file to my uploads directory and then attaching the file to a post/adding it to the media library.

I can do this quite simply using the $_FILES function (a normal upload) but Base64 is required because I need to be able to submit images from all sorts of different applications.

My code looks like this...

Step 1 -

//Collect Base64 and convert to file
    $upload_dir = wp_upload_dir();
    $decoded = base64_decode($_POST['base64File']);
    $filename = 'newImage.jpg';
    $hashed_filename = MD5($filename . microtime()) . '_' . $filename;
    $image_upload = file_put_contents($upload_dir['path'] . '\/' . $hashed_filename, $decoded);

    //HANDLE UPLOADED FILE
    if (!function_exists('wp_handle_sideload')) require_once(ABSPATH . 'wp-admin/includes/file.php');
    //upload file to server
    $file_return = wp_handle_sideload($image_upload, array('test_form' => false));
    //return error if there is one
    if(isset($file_return['error']) || isset($file_return['upload_error_handler'])) {
     $jsonReturn = array(
      'error'  =>  'Error uploading.',
      'code' => '95234'
      );
   } else {
   /**
    * See http://codex.wordpress.org/Function_Reference/wp_insert_attachment
    */
   $filename = $file_return['file'];
   $attachment = array(
     'post_mime_type' => $file_return['type'],
     'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
     'post_content' => '',
     'post_status' => 'inherit',
     'guid' => $wp_upload_dir['url'] . '/' . basename($filename)
     );
   $attach_id = wp_insert_attachment( $attachment, $filename, 289 );
   // you must first include the image.php file
   // for the function wp_generate_attachment_metadata() to work
   require_once(ABSPATH . 'wp-admin/includes/image.php');
   $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
   wp_update_attachment_metadata( $attach_id, $attach_data );
   $jsonReturn = array(
      'Status'  =>  'Success'
      );
 }

Basically what I am struggling to do is get '$image_upload' to conform to the first required parameter for

wp_handle_sideload($image_upload, array('test_form' => false));

as it says there are no file contents when it tries to execute.

Is there anyone with any idea/experience of dealing with Base64 strings/files???


kmurrayfrgraphics on "Javascript not functioning properly on wordpress"

$
0
0

A few weeks ago I added this javascript to my website and had it properly working on my website, but now it seems to not be functioning.

http://working.frgraphicsolutions.com/services/

The script is called:

tooltips.js

***It is a javascript that will make the <abbr> tag to become responsive so when a person is viewing the site on a mobile device they can click instead of hover over the object and it will allow them to see the information.***

Unfortunately even though the page is calling the javascript it is not preforming it's function. So the viewer will not be able to see the information at all when on a phone or tablet.

The code reads like this:

jQuery( document ).ready( function($)
    {
    var targets = $( '[rel~=tooltip]' ),
        target  = false,
        tooltip = false,
        title   = false;

    targets.bind( 'mouseenter', function()
    {
        target  = $( this );
        tip     = target.attr( 'title' );
        tooltip = $( '<div id="tooltip"></div>' );

        if( !tip || tip == '' )
            return false;

        target.removeAttr( 'title' );
        tooltip.css( 'opacity', 0 )
               .html( tip )
               .appendTo( 'body' );

        var init_tooltip = function()
        {
            if( $( window ).width() < tooltip.outerWidth() * 1.5 )
                tooltip.css( 'max-width', $( window ).width() / 2 );
            else
                tooltip.css( 'max-width', 340 );

            var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
                pos_top  = target.offset().top - tooltip.outerHeight() - 20;

            if( pos_left < 0 )
            {
                pos_left = target.offset().left + target.outerWidth() / 2 - 20;
                tooltip.addClass( 'left' );
            }
            else
                tooltip.removeClass( 'left' );

            if( pos_left + tooltip.outerWidth() > $( window ).width() )
            {
                pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
                tooltip.addClass( 'right' );
            }
            else
                tooltip.removeClass( 'right' );

            if( pos_top < 0 )
            {
                var pos_top  = target.offset().top + target.outerHeight();
                tooltip.addClass( 'top' );
            }
            else
                tooltip.removeClass( 'top' );

            tooltip.css( { left: pos_left, top: pos_top } )
                   .animate( { top: '+=10', opacity: 1 }, 50 );
        };

        init_tooltip();
        $( window ).resize( init_tooltip );

        var remove_tooltip = function()
        {
            tooltip.animate( { top: '-=10', opacity: 0 }, 50, function()
            {
                $( this ).remove();
            });

            target.attr( 'title', tip );
        };

        target.bind( 'mouseleave', remove_tooltip );
        tooltip.bind( 'click', remove_tooltip );
    });
    });

I created a function.php for the child theme that has the code only called to on this specific page:

<?php
    if ( !function_exists( 'tool_tips' ) ) {
    function tooltips() {
    if ( is_page( 'services' ) ) {
    wp_enqueue_script( 'tooltips', get_stylesheet_directory_uri() . '/js/tooltips.js', '', '1.0', true );
    }
    }
    }
    add_action( 'wp_enqueue_scripts', 'tooltips' );

    ?>

Like I stated earlier, it has been functioning the past few weeks with no issues (I even checked it over this past weekend) and today I noticed it stopped working.

Since the page is actually calling the script, but it is not functioning I believe there is something wrong with my script or another script is effecting it. I am new to jQuery, so it is harder for me to find issues through the code when I know many here can see pretty easily.

Thank you very much.

[Moderator Note: Please ensure that you are embedding links correctly in your posts.]

hedgehogOo on "oEmbed and youtube autoplay"

$
0
0

Hello,
In a website with 3000+ articles, I pull a youtube video url (youtube.com/watch?v=XXXXX) from a custom field, then into the template file I filter it through the_content: <?php echo apply_filters('the_content', *customfield*); ?> so it can be automatically oEmbedded.

Now my client wants to autoplay those videos in all the articles and I'm having troubles doing it.

Manually appending ?autoplay=true to the video url appears to be not supported by oEmbed: the url will not be embedded.

I also tried to code the embed iframe into my template file: <iframe src="*customfield*" frameborder="0" allowfullscreen></iframe> but it does not work because it requires the url to be youtube.com/embed/XXXXX whereas all my custom field data is in the youtube.com/watch?v=XXXXX format.

So my only solution is to manually edit all 3000+ articles to transform the "normal" youtube urls into the embedded ones?

Am I missing something here? Maybe some oEmbed filter that I don't know how to use?

Thank you for your time

another-webmaster on "taxonomies"

$
0
0

Trying to make a function which put taxonomy and terms on posting.

It should not have a hyperlink, looking in the codex made it first easy..copy/paste/edit and done but how to do it with multiple taxonomies and terms? Seldom is shown (in codex) how to do for multiple issues/options so I am stuck. Any help would be nice.

function my_function($content) {

if (is_single()) {

global $post, $site, $article;

$terms = get_the_terms($post->ID, 'site');
$terms = get_the_terms($post->ID, 'article') ;

if ( $terms && ! is_wp_error( $terms ) ) :
   $site = array();
   $article = array();  

   foreach ( $terms as $term ) {
	$site_links[] = $term->name ;
	$article_links[] = $term->name ;
   }

   $site = join( ", ", $site_links );
   $article = join( ", ", $article_links ); 

   ?>
   <p>
   Site: <strong><?php echo $site; ?></strong><br />
   Article: <strong><?php echo $article; ?></strong>
   </p>
   <?php
   endif;
   return $content;
   } else {
   return $content;
   }
}

add_filter('the_content', 'my_function');

It shows only outcome for Article (on both), it skips Site, what am I missing or doing wrong?

ussailing on "Display Menu only if Current Page is in Menu"

$
0
0

I have a site set up where I am using the Advanced Custom Field nav menu which is pulling in a menu and I can select which menu is on the page. The problem I am having is I don't want to show the entire (100+) pages that are in the menu but only the child pages of the page that I am currently on.

dev.ussailing.org/index.php/education

On that page I have a child page navigation plugin in use and below that is the menu I am trying to work with...The reason I am trying to do this is basically because I have pages that I want to be on multiple pages in their navigation and wordpress only lets you set one parent page in the page tree.

AaronRhoades on "Excerpt ... the loop? recent posts on another page besides the blog page..."

$
0
0

I have a website. http://www.aaronrhoades.com/blog is where it's at right now (will be moving it to http://www.aaronrhoades.com when it's done).

I'm trying to get the little thing on the upper right corner to work. EVERYTHING IS PERFECT... EXCEPT.... the excerpt is from the home page, rather than from each individual post... how do I fix it?

<?php
	$args = array( 'numberposts' => '4' );
	$recent_posts = wp_get_recent_posts( $args );
	foreach( $recent_posts as $recent ){
		echo '<li><h3><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"]. "</a></h3>" . get_the_excerpt() . "</li>" ;
	}
?>

I need them to be list items. I think the problem, lies in "get_the_excerpt" which I had tried using the_excerpt, but that didn't work either. how do i specify where to grab the excerpt? not sure if I'm in the wrong direction.

Viewing all 8245 articles
Browse latest View live


Latest Images